Reduce classes with pycompile attribute

This commit is contained in:
Pradyun Gedam 2018-01-20 17:09:01 +05:30
parent b1cb27d34e
commit 01c985a663
No known key found for this signature in database
GPG Key ID: DA17C4B29CB32E4B
3 changed files with 12 additions and 15 deletions

View File

@ -243,7 +243,6 @@ class InstallCommand(RequirementCommand):
options.build_dir, delete=build_delete, kind="install"
) as directory:
requirement_set = RequirementSet(
pycompile=options.compile,
require_hashes=options.require_hashes,
)
@ -295,6 +294,7 @@ class InstallCommand(RequirementCommand):
root=options.root_path,
home=target_temp_dir.path,
prefix=options.prefix_path,
pycompile=options.compile,
warn_script_location=options.warn_script_location,
use_user_site=options.use_user_site,
)

View File

@ -70,7 +70,7 @@ class InstallRequirement(object):
"""
def __init__(self, req, comes_from, source_dir=None, editable=False,
link=None, update=True, pycompile=True, markers=None,
link=None, update=True, markers=None,
isolated=False, options=None, wheel_cache=None,
constraint=False, extras=()):
assert req is None or isinstance(req, Requirement), req
@ -121,7 +121,6 @@ class InstallRequirement(object):
# UninstallPathSet of uninstalled distribution (for possible rollback)
self.uninstalled_pathset = None
self.options = options if options else {}
self.pycompile = pycompile
# Set to True after successful preparation of this requirement
self.prepared = False
@ -730,7 +729,7 @@ class InstallRequirement(object):
def install(self, install_options, global_options=None, root=None,
home=None, prefix=None, warn_script_location=True,
use_user_site=False):
use_user_site=False, pycompile=True):
global_options = global_options if global_options is not None else []
if self.editable:
self.install_editable(
@ -744,7 +743,7 @@ class InstallRequirement(object):
self.move_wheel_files(
self.source_dir, root=root, prefix=prefix, home=home,
warn_script_location=warn_script_location,
use_user_site=use_user_site,
use_user_site=use_user_site, pycompile=pycompile,
)
self.install_succeeded = True
return
@ -763,7 +762,7 @@ class InstallRequirement(object):
with TempDirectory(kind="record") as temp_dir:
record_filename = os.path.join(temp_dir.path, 'install-record.txt')
install_args = self.get_install_args(
global_options, record_filename, root, prefix,
global_options, record_filename, root, prefix, pycompile,
)
msg = 'Running setup.py install for %s' % (self.name,)
with open_spinner(msg) as spinner:
@ -830,7 +829,8 @@ class InstallRequirement(object):
self.source_dir = self.build_location(parent_dir)
return self.source_dir
def get_install_args(self, global_options, record_filename, root, prefix):
def get_install_args(self, global_options, record_filename, root, prefix,
pycompile):
install_args = [sys.executable, "-u"]
install_args.append('-c')
install_args.append(SETUPTOOLS_SHIM % self.setup_py)
@ -843,7 +843,7 @@ class InstallRequirement(object):
if prefix is not None:
install_args += ['--prefix', prefix]
if self.pycompile:
if pycompile:
install_args += ["--compile"]
else:
install_args += ["--no-compile"]
@ -941,14 +941,15 @@ class InstallRequirement(object):
return self.link and self.link.is_wheel
def move_wheel_files(self, wheeldir, root=None, home=None, prefix=None,
warn_script_location=True, use_user_site=False):
warn_script_location=True, use_user_site=False,
pycompile=True):
move_wheel_files(
self.name, self.req, wheeldir,
user=use_user_site,
home=home,
root=root,
prefix=prefix,
pycompile=self.pycompile,
pycompile=pycompile,
isolated=self.isolated,
warn_script_location=warn_script_location,
)

View File

@ -12,9 +12,7 @@ logger = logging.getLogger(__name__)
class RequirementSet(object):
def __init__(self,
require_hashes=False,
pycompile=True):
def __init__(self, require_hashes=False):
"""Create a RequirementSet.
:param wheel_cache: The pip wheel cache, for passing to
@ -29,7 +27,6 @@ class RequirementSet(object):
self.unnamed_requirements = []
self.successfully_downloaded = []
self.reqs_to_cleanup = []
self.pycompile = pycompile
# Maps from install_req -> dependencies_of_install_req
self._dependencies = defaultdict(list)
@ -79,7 +76,6 @@ class RequirementSet(object):
wheel.filename
)
install_req.pycompile = self.pycompile
install_req.is_direct = (parent_req_name is None)
if not name: