mirror of
https://github.com/python/cpython.git
synced 2025-11-03 19:34:08 +00:00
Minor cleanup
- Rename an attribute and create it in initialize_options instead of finalize_options to match the other install_* classes - Remove unnecessary method call in tests
This commit is contained in:
parent
540edc6e66
commit
ba9b2689be
2 changed files with 7 additions and 12 deletions
|
|
@ -41,6 +41,7 @@ class install_distinfo(Command):
|
||||||
self.requested = None
|
self.requested = None
|
||||||
self.no_record = None
|
self.no_record = None
|
||||||
self.no_resources = None
|
self.no_resources = None
|
||||||
|
self.outfiles = []
|
||||||
|
|
||||||
def finalize_options(self):
|
def finalize_options(self):
|
||||||
self.set_undefined_options('install_dist',
|
self.set_undefined_options('install_dist',
|
||||||
|
|
@ -67,7 +68,6 @@ class install_distinfo(Command):
|
||||||
to_filename(safe_version(metadata['Version'])))
|
to_filename(safe_version(metadata['Version'])))
|
||||||
|
|
||||||
self.distinfo_dir = os.path.join(self.distinfo_dir, basename)
|
self.distinfo_dir = os.path.join(self.distinfo_dir, basename)
|
||||||
self.outputs = []
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
# FIXME dry-run should be used at a finer level, so that people get
|
# FIXME dry-run should be used at a finer level, so that people get
|
||||||
|
|
@ -87,19 +87,19 @@ class install_distinfo(Command):
|
||||||
metadata_path = os.path.join(self.distinfo_dir, 'METADATA')
|
metadata_path = os.path.join(self.distinfo_dir, 'METADATA')
|
||||||
logger.info('creating %s', metadata_path)
|
logger.info('creating %s', metadata_path)
|
||||||
self.distribution.metadata.write(metadata_path)
|
self.distribution.metadata.write(metadata_path)
|
||||||
self.outputs.append(metadata_path)
|
self.outfiles.append(metadata_path)
|
||||||
|
|
||||||
installer_path = os.path.join(self.distinfo_dir, 'INSTALLER')
|
installer_path = os.path.join(self.distinfo_dir, 'INSTALLER')
|
||||||
logger.info('creating %s', installer_path)
|
logger.info('creating %s', installer_path)
|
||||||
with open(installer_path, 'w') as f:
|
with open(installer_path, 'w') as f:
|
||||||
f.write(self.installer)
|
f.write(self.installer)
|
||||||
self.outputs.append(installer_path)
|
self.outfiles.append(installer_path)
|
||||||
|
|
||||||
if self.requested:
|
if self.requested:
|
||||||
requested_path = os.path.join(self.distinfo_dir, 'REQUESTED')
|
requested_path = os.path.join(self.distinfo_dir, 'REQUESTED')
|
||||||
logger.info('creating %s', requested_path)
|
logger.info('creating %s', requested_path)
|
||||||
open(requested_path, 'wb').close()
|
open(requested_path, 'wb').close()
|
||||||
self.outputs.append(requested_path)
|
self.outfiles.append(requested_path)
|
||||||
|
|
||||||
|
|
||||||
if not self.no_resources:
|
if not self.no_resources:
|
||||||
|
|
@ -115,7 +115,7 @@ class install_distinfo(Command):
|
||||||
for tuple in install_data.get_resources_out():
|
for tuple in install_data.get_resources_out():
|
||||||
writer.writerow(tuple)
|
writer.writerow(tuple)
|
||||||
|
|
||||||
self.outputs.append(resources_path)
|
self.outfiles.append(resources_path)
|
||||||
|
|
||||||
if not self.no_record:
|
if not self.no_record:
|
||||||
record_path = os.path.join(self.distinfo_dir, 'RECORD')
|
record_path = os.path.join(self.distinfo_dir, 'RECORD')
|
||||||
|
|
@ -141,10 +141,10 @@ class install_distinfo(Command):
|
||||||
|
|
||||||
# add the RECORD file itself
|
# add the RECORD file itself
|
||||||
writer.writerow((record_path, '', ''))
|
writer.writerow((record_path, '', ''))
|
||||||
self.outputs.append(record_path)
|
self.outfiles.append(record_path)
|
||||||
|
|
||||||
def get_outputs(self):
|
def get_outputs(self):
|
||||||
return self.outputs
|
return self.outfiles
|
||||||
|
|
||||||
|
|
||||||
# The following functions are taken from setuptools' pkg_resources module.
|
# The following functions are taken from setuptools' pkg_resources module.
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,6 @@ class InstallDistinfoTestCase(support.TempdirManager,
|
||||||
cmd = install_distinfo(dist)
|
cmd = install_distinfo(dist)
|
||||||
dist.command_obj['install_distinfo'] = cmd
|
dist.command_obj['install_distinfo'] = cmd
|
||||||
|
|
||||||
cmd.initialize_options()
|
|
||||||
cmd.distinfo_dir = install_dir
|
cmd.distinfo_dir = install_dir
|
||||||
cmd.ensure_finalized()
|
cmd.ensure_finalized()
|
||||||
cmd.run()
|
cmd.run()
|
||||||
|
|
@ -73,7 +72,6 @@ class InstallDistinfoTestCase(support.TempdirManager,
|
||||||
cmd = install_distinfo(dist)
|
cmd = install_distinfo(dist)
|
||||||
dist.command_obj['install_distinfo'] = cmd
|
dist.command_obj['install_distinfo'] = cmd
|
||||||
|
|
||||||
cmd.initialize_options()
|
|
||||||
cmd.distinfo_dir = install_dir
|
cmd.distinfo_dir = install_dir
|
||||||
cmd.installer = 'bacon-python'
|
cmd.installer = 'bacon-python'
|
||||||
cmd.ensure_finalized()
|
cmd.ensure_finalized()
|
||||||
|
|
@ -94,7 +92,6 @@ class InstallDistinfoTestCase(support.TempdirManager,
|
||||||
cmd = install_distinfo(dist)
|
cmd = install_distinfo(dist)
|
||||||
dist.command_obj['install_distinfo'] = cmd
|
dist.command_obj['install_distinfo'] = cmd
|
||||||
|
|
||||||
cmd.initialize_options()
|
|
||||||
cmd.distinfo_dir = install_dir
|
cmd.distinfo_dir = install_dir
|
||||||
cmd.requested = False
|
cmd.requested = False
|
||||||
cmd.ensure_finalized()
|
cmd.ensure_finalized()
|
||||||
|
|
@ -115,7 +112,6 @@ class InstallDistinfoTestCase(support.TempdirManager,
|
||||||
cmd = install_distinfo(dist)
|
cmd = install_distinfo(dist)
|
||||||
dist.command_obj['install_distinfo'] = cmd
|
dist.command_obj['install_distinfo'] = cmd
|
||||||
|
|
||||||
cmd.initialize_options()
|
|
||||||
cmd.distinfo_dir = install_dir
|
cmd.distinfo_dir = install_dir
|
||||||
cmd.no_record = True
|
cmd.no_record = True
|
||||||
cmd.ensure_finalized()
|
cmd.ensure_finalized()
|
||||||
|
|
@ -153,7 +149,6 @@ class InstallDistinfoTestCase(support.TempdirManager,
|
||||||
cmd = install_distinfo(dist)
|
cmd = install_distinfo(dist)
|
||||||
dist.command_obj['install_distinfo'] = cmd
|
dist.command_obj['install_distinfo'] = cmd
|
||||||
|
|
||||||
cmd.initialize_options()
|
|
||||||
cmd.distinfo_dir = install_dir
|
cmd.distinfo_dir = install_dir
|
||||||
cmd.ensure_finalized()
|
cmd.ensure_finalized()
|
||||||
cmd.run()
|
cmd.run()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue