Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ff52f76

Browse files
committed
#10679: install idle, pydoc, 2to3 scripts with X.Y suffix for make altinstall; create symlinks for make install.
1 parent 1564192 commit ff52f76

3 files changed

Lines changed: 39 additions & 2 deletions

File tree

Makefile.pre.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,12 @@ bininstall: altbininstall
870870
(cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-config python3-config)
871871
-rm -f $(DESTDIR)$(LIBPC)/python3.pc
872872
(cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION).pc python3.pc)
873+
-rm -f $(DESTDIR)$(BINDIR)/idle3
874+
(cd $(DESTDIR)$(BINDIR); $(LN) -s idle$(VERSION) idle3)
875+
-rm -f $(DESTDIR)$(BINDIR)/pydoc3
876+
(cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3)
877+
-rm -f $(DESTDIR)$(BINDIR)/2to3
878+
(cd $(DESTDIR)$(BINDIR); $(LN) -s 2to3-$(VERSION) 2to3)
873879

874880
# Install the manual page
875881
maninstall:

Misc/NEWS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ Library
4444

4545
- Deprecated assertDictContainsSubclass() in the unittest module.
4646

47+
Build
48+
-----
49+
50+
- Issue #10679: The "idle", "pydoc" and "2to3" scripts are now installed with
51+
a version-specific suffix on "make altinstall".
52+
4753

4854
What's New in Python 3.2 Beta 2?
4955
================================

setup.py

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from distutils.command.build_ext import build_ext
1515
from distutils.command.install import install
1616
from distutils.command.install_lib import install_lib
17+
from distutils.command.build_scripts import build_scripts
1718
from distutils.spawn import find_executable
1819

1920
# Were we compiled --with-pydebug or with #define Py_DEBUG?
@@ -1792,6 +1793,25 @@ def set_dir_modes(self, dirname, mode):
17921793
def is_chmod_supported(self):
17931794
return hasattr(os, 'chmod')
17941795

1796+
class PyBuildScripts(build_scripts):
1797+
def copy_scripts(self):
1798+
outfiles, updated_files = build_scripts.copy_scripts(self)
1799+
fullversion = '-{0[0]}.{0[1]}'.format(sys.version_info)
1800+
minoronly = '.{0[1]}'.format(sys.version_info)
1801+
newoutfiles = []
1802+
newupdated_files = []
1803+
for filename in outfiles:
1804+
if filename.endswith('2to3'):
1805+
newfilename = filename + fullversion
1806+
else:
1807+
newfilename = filename + minoronly
1808+
log.info('renaming {} to {}'.format(filename, newfilename))
1809+
os.rename(filename, newfilename)
1810+
newoutfiles.append(newfilename)
1811+
if filename in updated_files:
1812+
newupdated_files.append(newfilename)
1813+
return newoutfiles, newupdated_files
1814+
17951815
SUMMARY = """
17961816
Python is an interpreted, interactive, object-oriented programming
17971817
language. It is often compared to Tcl, Perl, Scheme or Java.
@@ -1837,12 +1857,17 @@ def main():
18371857
platforms = ["Many"],
18381858

18391859
# Build info
1840-
cmdclass = {'build_ext':PyBuildExt, 'install':PyBuildInstall,
1841-
'install_lib':PyBuildInstallLib},
1860+
cmdclass = {'build_ext': PyBuildExt,
1861+
'build_scripts': PyBuildScripts,
1862+
'install': PyBuildInstall,
1863+
'install_lib': PyBuildInstallLib},
18421864
# The struct module is defined here, because build_ext won't be
18431865
# called unless there's at least one extension module defined.
18441866
ext_modules=[Extension('_struct', ['_struct.c'])],
18451867

1868+
# If you change the scripts installed here, you also need to
1869+
# check the PyBuildScripts command above, and change the links
1870+
# created by the bininstall target in Makefile.pre.in
18461871
scripts = ["Tools/scripts/pydoc3", "Tools/scripts/idle3",
18471872
"Tools/scripts/2to3"]
18481873
)

0 commit comments

Comments
 (0)