Re-evaluate the usage of ExecutableRequirement
# In GoErrCHeckBear.py
REQUIREMENTS = {GoRequirement(
package='github.com/kisielk/errcheck', flag='-u')}
# In GoRequirement.py
REQUIREMENTS = {ExecutableRequirement('go')}
# In ExecutableRequirement.py
PackageRequirement.__init__(self, 'exec', executable, '')
Currently, classes are defined as follow:
class ExecutableRequirement(PackageRequirement):
def __init__(self, executable):
...
def is_installed(self):
return is_executable_exists(self.executable)
class DistributionRequirement(PackageRequirement):
def __init__(self, package: str=None, version='', repo='',
**package_overrides):
...
def get_installed_version(self):
...
def is_installed(self):
...
def install_command(self):
...
class PackageRequirement:
def __init__(self, type: str, package: str, version="", repo=""):
...
def install_package(self):
...
On a system without Go
installed, ExecutableRequirement
doesn't provide or trigger install commands, and it's hard to do so if ExecutableRequirement
invokes DistributionRequirement
.
I am proposing to have ExecutableRequirement
inherit from DistributionRequirement
instead, or remove ElectutableRequirement
, add is_executable_exists()
to DistributionRequirement
and have GoRequirement
use that.