[Python-checkins] python/nondist/sandbox/setuptools/setuptools/command bdist_rpm.py, 1.1, 1.2 install.py, 1.5, 1.6
pje@users.sourceforge.net
pje at users.sourceforge.net
Sat Sep 3 06:51:38 CEST 2005
Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11938/setuptools/command
Modified Files:
bdist_rpm.py install.py
Log Message:
Added support for old-style RPMs (i.e. non-egg RPMs)
Index: bdist_rpm.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command/bdist_rpm.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- bdist_rpm.py 21 Aug 2005 23:33:39 -0000 1.1
+++ bdist_rpm.py 3 Sep 2005 04:51:27 -0000 1.2
@@ -1,11 +1,33 @@
# This is just a kludge so that bdist_rpm doesn't guess wrong about the
-# distribution name and version, if the egg_info command is going to alter them
+# distribution name and version, if the egg_info command is going to alter
+# them, and another kludge to allow you to build old-style non-egg RPMs
from distutils.command.bdist_rpm import bdist_rpm as _bdist_rpm
class bdist_rpm(_bdist_rpm):
+ user_options = _bdist_rpm.user_options + [
+ ('no-egg', None, "Don't install as an egg (may break the package!)")
+ ]
+
+ boolean_options = _bdist_rpm.boolean_options + ['no-egg']
+
+ def initialize_options(self):
+ _bdist_rpm.initialize_options(self)
+ self.no_egg = None
+
def run(self):
self.run_command('egg_info') # ensure distro name is up-to-date
_bdist_rpm.run(self)
+ def _make_spec_file(self):
+ spec = _bdist_rpm._make_spec_file(self)
+ if not self.no_egg:
+ return spec
+
+ # Hack the spec file so that we install old-style
+ return [
+ line.replace(
+ "setup.py install ","setup.py install --old-and-unmanageable "
+ ) for line in spec
+ ]
Index: install.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command/install.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- install.py 22 Aug 2005 13:40:10 -0000 1.5
+++ install.py 3 Sep 2005 04:51:27 -0000 1.6
@@ -4,6 +4,16 @@
class install(_install):
"""Use easy_install to install the package, w/dependencies"""
+ user_options = _install.user_options + [
+ ('old-and-unmanageable', None, "Try not to use this!"),
+ ]
+
+ boolean_options = _install.boolean_options + ['old-and-unmanageable']
+
+ def initialize_options(self):
+ _install.initialize_options(self)
+ self.old_and_unmanageable = None
+
def handle_extra_path(self):
# We always ignore extra_path, because we always install eggs
# (you can always use install_* commands directly if needed)
@@ -11,23 +21,24 @@
self.extra_dirs = ''
def run(self):
- calling_module = sys._getframe(1).f_globals.get('__name__','')
- if calling_module != 'distutils.dist':
- # We're not being run from the command line, so use old-style
- # behavior. This is a bit kludgy, because a command might use
- # dist.run_command() to run 'install', but bdist_dumb and
- # bdist_wininst both call run directly at the moment.
- # When this is part of the distutils, the old install behavior
- # should probably be requested with a flag, or a different method.
+ if (self.old_and_unmanageable or
+ sys._getframe(1).f_globals.get('__name__','') != 'distutils.dist'
+ ):
+ # Either we were asked for the old behavior, or we're not being
+ # run from the command line. This is a bit kludgy, because a
+ # command might use dist.run_command() to run 'install', but
+ # bdist_dumb and bdist_wininst both call run() directly right now.
return _install.run(self)
from setuptools.command.easy_install import easy_install
+
cmd = easy_install(
self.distribution, args="x", ignore_conflicts_at_my_risk=1,
root=self.root
)
cmd.ensure_finalized() # finalize before bdist_egg munges install cmd
+
self.run_command('bdist_egg')
args = [self.distribution.get_command_obj('bdist_egg').egg_output]
@@ -39,3 +50,33 @@
cmd.run()
setuptools.bootstrap_install_from = None
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
More information about the Python-checkins
mailing list