]> granicus.if.org Git - python/commitdiff
Patch #736857, #736859: Add -e option to build_scripts.
authorMartin v. Löwis <martin@v.loewis.de>
Wed, 25 Aug 2004 11:37:43 +0000 (11:37 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Wed, 25 Aug 2004 11:37:43 +0000 (11:37 +0000)
Doc/dist/dist.tex
Lib/distutils/command/build.py
Lib/distutils/command/build_scripts.py
Misc/NEWS

index b09f1e0caf67bc60ffba0d58605aeb6c5f9feb6a..b590b31861854b453b90db380e53b40b2a132e23 100644 (file)
@@ -640,7 +640,9 @@ started from the command line.  Scripts don't require Distutils to do
 anything very complicated.  The only clever feature is that if the
 first line of the script starts with \code{\#!} and contains the word
 ``python'', the Distutils will adjust the first line to refer to the
-current interpreter location.
+current interpreter location. By default, it is replaced with the
+current interpreter location.  The '--executable=/-e' switch will
+allow the interpreter path to be explicitly overridden.
 
 The \option{scripts} option simply is a list of files to be handled
 in this way.  From the PyXML setup script:
index 78231541ec286d04ff3ae3652c6bc4031fc3b6d3..e6b3991f150a458cbc39bb162edcd33f140b0929 100644 (file)
@@ -40,6 +40,8 @@ class build (Command):
          "compile extensions and libraries with debugging information"),
         ('force', 'f',
          "forcibly build everything (ignore file timestamps)"),
+        ('executable=', 'e',
+         "specify final destination interpreter path (build.py)"),
         ]
 
     boolean_options = ['debug', 'force']
@@ -61,6 +63,7 @@ class build (Command):
         self.compiler = None
         self.debug = None
         self.force = 0
+        self.executable = None
 
     def finalize_options (self):
 
@@ -93,6 +96,8 @@ class build (Command):
             self.build_scripts = os.path.join(self.build_base,
                                               'scripts-' + sys.version[0:3])
 
+        if self.executable is None:
+            self.executable = os.path.normpath(sys.executable)
     # finalize_options ()
 
 
index e0fcc23e13f52efa506177d9af7262833b171807..fb73719f57e00e2f48690f41537991740f859f28 100644 (file)
@@ -24,6 +24,7 @@ class build_scripts (Command):
     user_options = [
         ('build-dir=', 'd', "directory to \"build\" (copy) to"),
         ('force', 'f', "forcibly build everything (ignore file timestamps"),
+        ('executable=', 'e', "specify final destination interpreter path"),
         ]
 
     boolean_options = ['force']
@@ -33,12 +34,14 @@ class build_scripts (Command):
         self.build_dir = None
         self.scripts = None
         self.force = None
+        self.executable = None
         self.outfiles = None
 
     def finalize_options (self):
         self.set_undefined_options('build',
                                    ('build_scripts', 'build_dir'),
-                                   ('force', 'force'))
+                                   ('force', 'force'),
+                                   ('executable', 'executable'))
         self.scripts = self.distribution.scripts
 
     def get_source_files(self):
@@ -95,7 +98,7 @@ class build_scripts (Command):
                     outf = open(outfile, "w")
                     if not sysconfig.python_build:
                         outf.write("#!%s%s\n" %
-                                   (os.path.normpath(sys.executable),
+                                   (self.executable,
                                     post_interp))
                     else:
                         outf.write("#!%s%s\n" %
index be445c96c0236cd64658f43c3bd60821c6bec874..9ce8c2d37956878eae8fa56b8a9236d99605b055 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -57,6 +57,9 @@ Extension modules
 Library
 -------
 
+- distutils build/build_scripts now has an -e option to specify the
+  path to the Python interpreter for installed scripts.
+
 - PEP 292 classes Template and SafeTemplate are added to the string module.
 
 - tarfile now generates GNU tar files by default.