Commit b577c941 authored by PJ Eby's avatar PJ Eby

Make easy_install --record strip the RPM root when building RPMs, and have

bdist_egg ignore the RPM root when building an egg.  This version now can
actually run bdist_rpm to completion, although the resulting RPM will
install an egg without a corresponding .pth file.

--HG--
branch : setuptools
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4041226
parent cbccc4ea
...@@ -170,7 +170,11 @@ class bdist_egg(Command): ...@@ -170,7 +170,11 @@ class bdist_egg(Command):
# pull their data path from the install_lib command. # pull their data path from the install_lib command.
log.info("installing library code to %s" % self.bdist_dir) log.info("installing library code to %s" % self.bdist_dir)
instcmd = self.get_finalized_command('install')
old_root = instcmd.root
instcmd.root = None
cmd = self.call_command('install_lib', warn_dir=0) cmd = self.call_command('install_lib', warn_dir=0)
instcmd.root = old_root
ext_outputs = cmd._mutate_outputs( ext_outputs = cmd._mutate_outputs(
self.distribution.has_ext_modules(), 'build_ext', 'build_lib', '' self.distribution.has_ext_modules(), 'build_ext', 'build_lib', ''
......
...@@ -90,6 +90,7 @@ class easy_install(Command): ...@@ -90,6 +90,7 @@ class easy_install(Command):
self.optimize = self.record = None self.optimize = self.record = None
self.upgrade = self.always_copy = self.multi_version = None self.upgrade = self.always_copy = self.multi_version = None
self.editable = None self.editable = None
self.root = None
# Options not specifiable via command line # Options not specifiable via command line
self.package_index = None self.package_index = None
...@@ -120,7 +121,6 @@ class easy_install(Command): ...@@ -120,7 +121,6 @@ class easy_install(Command):
def finalize_options(self): def finalize_options(self):
# If a non-default installation directory was specified, default the # If a non-default installation directory was specified, default the
# script directory to match it. # script directory to match it.
...@@ -224,9 +224,14 @@ class easy_install(Command): ...@@ -224,9 +224,14 @@ class easy_install(Command):
for spec in self.args: for spec in self.args:
self.easy_install(spec, True) self.easy_install(spec, True)
if self.record: if self.record:
outputs = self.outputs
if self.root: # strip any package prefix
root_len = len(self.root)
for counter in xrange(len(outputs)):
outputs[counter] = outputs[counter][root_len:]
from distutils import file_util from distutils import file_util
self.execute( self.execute(
file_util.write_file, (self.record, self.outputs), file_util.write_file, (self.record, outputs),
"writing list of installed files to '%s'" % "writing list of installed files to '%s'" %
self.record self.record
) )
...@@ -239,11 +244,6 @@ class easy_install(Command): ...@@ -239,11 +244,6 @@ class easy_install(Command):
def add_output(self, path): def add_output(self, path):
if os.path.isdir(path): if os.path.isdir(path):
for base, dirs, files in os.walk(path): for base, dirs, files in os.walk(path):
......
...@@ -23,7 +23,8 @@ class install(_install): ...@@ -23,7 +23,8 @@ class install(_install):
from setuptools.command.easy_install import easy_install from setuptools.command.easy_install import easy_install
cmd = easy_install( cmd = easy_install(
self.distribution, args="x", ignore_conflicts_at_my_risk=1 self.distribution, args="x", ignore_conflicts_at_my_risk=1,
root=self.root
) )
cmd.ensure_finalized() # finalize before bdist_egg munges install cmd cmd.ensure_finalized() # finalize before bdist_egg munges install cmd
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment