]> granicus.if.org Git - python/commitdiff
#10679: install idle, pydoc, 2to3 scripts with X.Y suffix for make altinstall; create...
authorGeorg Brandl <georg@python.org>
Tue, 28 Dec 2010 09:51:43 +0000 (09:51 +0000)
committerGeorg Brandl <georg@python.org>
Tue, 28 Dec 2010 09:51:43 +0000 (09:51 +0000)
Makefile.pre.in
Misc/NEWS
setup.py

index edbb7dda142d098476b56855b21afc3cdde79a4f..aa6d3a883457eee8651f5d56146fed466429a730 100644 (file)
@@ -870,6 +870,12 @@ bininstall: altbininstall
        (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-config python3-config)
        -rm -f $(DESTDIR)$(LIBPC)/python3.pc
        (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION).pc python3.pc)
+       -rm -f $(DESTDIR)$(BINDIR)/idle3
+       (cd $(DESTDIR)$(BINDIR); $(LN) -s idle$(VERSION) idle3)
+       -rm -f $(DESTDIR)$(BINDIR)/pydoc3
+       (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3)
+       -rm -f $(DESTDIR)$(BINDIR)/2to3
+       (cd $(DESTDIR)$(BINDIR); $(LN) -s 2to3-$(VERSION) 2to3)
 
 # Install the manual page
 maninstall:
index 7d2085afda8cc24144124ea2d0e598361f0e2ff0..8acc9e387a1ddd022cb1b9d552274971e2f55192 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -44,6 +44,12 @@ Library
 
 - Deprecated assertDictContainsSubclass() in the unittest module.
 
+Build
+-----
+
+- Issue #10679: The "idle", "pydoc" and "2to3" scripts are now installed with
+  a version-specific suffix on "make altinstall".
+
 
 What's New in Python 3.2 Beta 2?
 ================================
index 09cc8a911fbe7d1f9b7028776224eac4016ca786..79d9f624da6095463a4ce729c93d6b943bec8b4a 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -14,6 +14,7 @@ from distutils.core import Extension, setup
 from distutils.command.build_ext import build_ext
 from distutils.command.install import install
 from distutils.command.install_lib import install_lib
+from distutils.command.build_scripts import build_scripts
 from distutils.spawn import find_executable
 
 # Were we compiled --with-pydebug or with #define Py_DEBUG?
@@ -1792,6 +1793,25 @@ class PyBuildInstallLib(install_lib):
     def is_chmod_supported(self):
         return hasattr(os, 'chmod')
 
+class PyBuildScripts(build_scripts):
+    def copy_scripts(self):
+        outfiles, updated_files = build_scripts.copy_scripts(self)
+        fullversion = '-{0[0]}.{0[1]}'.format(sys.version_info)
+        minoronly = '.{0[1]}'.format(sys.version_info)
+        newoutfiles = []
+        newupdated_files = []
+        for filename in outfiles:
+            if filename.endswith('2to3'):
+                newfilename = filename + fullversion
+            else:
+                newfilename = filename + minoronly
+            log.info('renaming {} to {}'.format(filename, newfilename))
+            os.rename(filename, newfilename)
+            newoutfiles.append(newfilename)
+            if filename in updated_files:
+                newupdated_files.append(newfilename)
+        return newoutfiles, newupdated_files
+
 SUMMARY = """
 Python is an interpreted, interactive, object-oriented programming
 language. It is often compared to Tcl, Perl, Scheme or Java.
@@ -1837,12 +1857,17 @@ def main():
           platforms = ["Many"],
 
           # Build info
-          cmdclass = {'build_ext':PyBuildExt, 'install':PyBuildInstall,
-                      'install_lib':PyBuildInstallLib},
+          cmdclass = {'build_ext': PyBuildExt,
+                      'build_scripts': PyBuildScripts,
+                      'install': PyBuildInstall,
+                      'install_lib': PyBuildInstallLib},
           # The struct module is defined here, because build_ext won't be
           # called unless there's at least one extension module defined.
           ext_modules=[Extension('_struct', ['_struct.c'])],
 
+          # If you change the scripts installed here, you also need to
+          # check the PyBuildScripts command above, and change the links
+          # created by the bininstall target in Makefile.pre.in
           scripts = ["Tools/scripts/pydoc3", "Tools/scripts/idle3",
                      "Tools/scripts/2to3"]
         )