Commit c0b9274d authored by Matthias Klose's avatar Matthias Klose

- add debian packaging files

parent 3cfad359
The documentation for this package is in /usr/share/doc/pythonX.Y,
where X.Y is the Python version used.
A draft of the "Debian Python Policy" can be found in
/usr/share/doc/python
Sometime it will be moved to /usr/share/doc/debian-policy in the
debian-policy package.
Tkinter documentation can be found at
http://www.pythonware.com/library/index.htm
more specific:
http://www.pythonware.com/library/tkinter/introduction/index.htm
http://www.pythonware.com/library/tkinter/an-introduction-to-tkinter.pdf
This diff is collapsed.
Source: python3-stdlib-extensions
Section: python
Priority: optional
Maintainer: Matthias Klose <doko@debian.org>
Build-Depends: debhelper (>= 9), rdfind,
libpython3-all-dev, libpython3-all-dbg,
python3-all-dev:any, python3-all-dbg:any,
libpython3.7-dev, libpython3.7-dbg (>= 3.7.0~b1),
python3.7-dev:any, python3.7-dbg:any,
tk-dev, blt-dev (>= 2.4z-9), libgdbm-dev
Build-Conflicts: tcl8.4-dev, tk8.4-dev, tcl8.5-dev, tk8.5-dev
Standards-Version: 4.1.3
Package: python3-tk
Architecture: any
Multi-Arch: same
Depends: ${python3:Depends}, blt (>= 2.4z-9), ${shlibs:Depends}, ${misc:Depends}
Provides: ${python3:Provides}
Suggests: tix, python3-tk-dbg
Breaks: libpython3.6-stdlib (<< 3.6.4~rc1-2), libpython3.7-stdlib (<< 3.7.0~a3-2)
Replaces: libpython3.6-stdlib (<< 3.6.4~rc1-2), libpython3.7-stdlib (<< 3.7.0~a3-2)
Description: Tkinter - Writing Tk applications with Python 3.x
A module for writing portable GUI applications with Python 3.x using Tk.
Also known as Tkinter.
Package: python3-gdbm
Architecture: any
Multi-Arch: same
Depends: ${python3:Depends}, ${shlibs:Depends}, ${misc:Depends}
Provides: ${python3:Provides}
Suggests: python3-gdbm-dbg
Replaces: python3.0 (<< 3.0.1)
Description: GNU dbm database support for Python 3.x
GNU dbm database module for Python 3.x. Install this if you want to
create or read GNU dbm database files with Python.
Package: python3-tk-dbg
Architecture: any
Multi-Arch: same
Priority: optional
Section: debug
Depends: ${python3:Depends}, python3-tk (= ${binary:Version}), blt (>= 2.4z-9), ${shlibs:Depends}, ${misc:Depends}
Description: Tkinter - Writing Tk applications with Python 3.x (debug extension)
A module for writing portable GUI applications with Python using Tk.
Also known as Tkinter.
.
This package contains the extensions built for the python3 debug interpreter.
Package: python3-gdbm-dbg
Architecture: any
Multi-Arch: same
Priority: optional
Section: debug
Depends: ${python3:Depends}, python3-gdbm (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
Description: GNU dbm database support for Python 3.x (debug extension)
GNU dbm database module for Python 3.x. Install this if you want to
create or read GNU dbm database files with Python.
.
This package contains the extensions built for the python3 debug interpreter.
Package: python3-distutils
Architecture: all
Multi-Arch: foreign
Depends: ${python3:Depends}, ${misc:Depends}, python3-lib2to3 (>= 3.6.4),
Provides: ${python3:Provides}
Breaks: libpython3.6-stdlib (<< 3.6.5~rc1-3), libpython3.7-stdlib (<< 3.7.0~b2-2),
# python3-setuptools (<< 38.2.4-2)
Replaces: libpython3.6-stdlib (<< 3.6.4~rc1-2), libpython3.7-stdlib (<< 3.7.0~a3-2)
Description: distutils package for Python 3.x
Distutils package for Python 3.x. This package contains the distutils module
from the Python standard library.
Package: python3-lib2to3
Architecture: all
Multi-Arch: foreign
Priority: optional
Depends: ${python3:Depends}, ${misc:Depends}
Provides: ${python3:Provides}
Breaks: libpython3.6-stdlib (<< 3.6.4~rc1-2),
libpython3.7-stdlib (<< 3.7.0~a3-3),
python3.6-2to3 (<< 3.6.4-2),
python3.7-2to3 (<< 3.7.0~a3-3),
Replaces: libpython3.6-stdlib (<< 3.6.4~rc1-2),
libpython3.7-stdlib (<< 3.7.0~a3-3),
python3.6-2to3 (<< 3.6.4-2),
python3.7-2to3 (<< 3.7.0~a3-3),
Description: Interactive high-level object-oriented language (2to3, version 3.6)
Python is a high-level, interactive, object-oriented language. Its 3.6 version
includes an extensive class library with lots of goodies for
network programming, system administration, sounds and graphics.
.
This package contains the lib2to3 library.
This diff is collapsed.
# DP: suggest installation of the pythonX.Y-dev package, if bdist_wininst
# DP: cannot find the wininst-* files.
Index: b/3.6/Lib/distutils/command/bdist_wininst.py
===================================================================
--- a/3.6/Lib/distutils/command/bdist_wininst.py
+++ b/3.6/Lib/distutils/command/bdist_wininst.py
@@ -358,7 +358,10 @@ class bdist_wininst(Command):
sfix = ''
filename = os.path.join(directory, "wininst-%s%s.exe" % (bv, sfix))
- f = open(filename, "rb")
+ try:
+ f = open(filename, "rb")
+ except IOError as e:
+ raise DistutilsFileError(str(e) + ', %s not included in the Debian packages.' % filename)
try:
return f.read()
finally:
# DP: Disable some failing tests we are not interested in
Index: b/3.6/Lib/distutils/tests/test_build_ext.py
===================================================================
--- a/3.6/Lib/distutils/tests/test_build_ext.py
+++ b/3.6/Lib/distutils/tests/test_build_ext.py
@@ -102,6 +102,7 @@ class BuildExtTestCase(TempdirManager,
build_ext.USER_BASE = self.old_user_base
super(BuildExtTestCase, self).tearDown()
+ @unittest.skip('Skipping failing Solaris test')
def test_solaris_enable_shared(self):
dist = Distribution({'name': 'xx'})
cmd = self.build_ext(dist)
# DP: distutils: Add an option --install-layout=deb, which
# DP: - installs into $prefix/dist-packages instead of $prefix/site-packages.
# DP: - doesn't encode the python version into the egg name.
Index: b/3.6/Lib/distutils/command/install_egg_info.py
===================================================================
--- a/3.6/Lib/distutils/command/install_egg_info.py
+++ b/3.6/Lib/distutils/command/install_egg_info.py
@@ -14,18 +14,38 @@ class install_egg_info(Command):
description = "Install package's PKG-INFO metadata as an .egg-info file"
user_options = [
('install-dir=', 'd', "directory to install to"),
+ ('install-layout', None, "custom installation layout"),
]
def initialize_options(self):
self.install_dir = None
+ self.install_layout = None
+ self.prefix_option = None
def finalize_options(self):
self.set_undefined_options('install_lib',('install_dir','install_dir'))
- basename = "%s-%s-py%d.%d.egg-info" % (
- to_filename(safe_name(self.distribution.get_name())),
- to_filename(safe_version(self.distribution.get_version())),
- *sys.version_info[:2]
- )
+ self.set_undefined_options('install',('install_layout','install_layout'))
+ self.set_undefined_options('install',('prefix_option','prefix_option'))
+ if self.install_layout:
+ if not self.install_layout.lower() in ['deb', 'unix']:
+ raise DistutilsOptionError(
+ "unknown value for --install-layout")
+ no_pyver = (self.install_layout.lower() == 'deb')
+ elif self.prefix_option:
+ no_pyver = False
+ else:
+ no_pyver = True
+ if no_pyver:
+ basename = "%s-%s.egg-info" % (
+ to_filename(safe_name(self.distribution.get_name())),
+ to_filename(safe_version(self.distribution.get_version()))
+ )
+ else:
+ basename = "%s-%s-py%d.%d.egg-info" % (
+ to_filename(safe_name(self.distribution.get_name())),
+ to_filename(safe_version(self.distribution.get_version())),
+ *sys.version_info[:2]
+ )
self.target = os.path.join(self.install_dir, basename)
self.outputs = [self.target]
Index: b/3.6/Lib/distutils/command/install.py
===================================================================
--- a/3.6/Lib/distutils/command/install.py
+++ b/3.6/Lib/distutils/command/install.py
@@ -35,6 +35,20 @@ INSTALL_SCHEMES = {
'scripts': '$base/bin',
'data' : '$base',
},
+ 'unix_local': {
+ 'purelib': '$base/local/lib/python$py_version_short/dist-packages',
+ 'platlib': '$platbase/local/lib/python$py_version_short/dist-packages',
+ 'headers': '$base/local/include/python$py_version_short/$dist_name',
+ 'scripts': '$base/local/bin',
+ 'data' : '$base/local',
+ },
+ 'deb_system': {
+ 'purelib': '$base/lib/python3/dist-packages',
+ 'platlib': '$platbase/lib/python3/dist-packages',
+ 'headers': '$base/include/python$py_version_short/$dist_name',
+ 'scripts': '$base/bin',
+ 'data' : '$base',
+ },
'unix_home': {
'purelib': '$base/lib/python',
'platlib': '$base/lib/python',
@@ -131,6 +145,9 @@ class install(Command):
('record=', None,
"filename in which to record list of installed files"),
+
+ ('install-layout=', None,
+ "installation layout to choose (known values: deb, unix)"),
]
boolean_options = ['compile', 'force', 'skip-build']
@@ -151,6 +168,7 @@ class install(Command):
self.exec_prefix = None
self.home = None
self.user = 0
+ self.prefix_option = None
# These select only the installation base; it's up to the user to
# specify the installation scheme (currently, that means supplying
@@ -172,6 +190,9 @@ class install(Command):
self.install_userbase = USER_BASE
self.install_usersite = USER_SITE
+ # enable custom installation, known values: deb
+ self.install_layout = None
+
self.compile = None
self.optimize = None
@@ -413,6 +434,7 @@ class install(Command):
self.install_base = self.install_platbase = self.home
self.select_scheme("unix_home")
else:
+ self.prefix_option = self.prefix
if self.prefix is None:
if self.exec_prefix is not None:
raise DistutilsOptionError(
@@ -427,7 +449,26 @@ class install(Command):
self.install_base = self.prefix
self.install_platbase = self.exec_prefix
- self.select_scheme("unix_prefix")
+ if self.install_layout:
+ if self.install_layout.lower() in ['deb']:
+ self.select_scheme("deb_system")
+ elif self.install_layout.lower() in ['unix']:
+ self.select_scheme("unix_prefix")
+ else:
+ raise DistutilsOptionError(
+ "unknown value for --install-layout")
+ elif ((self.prefix_option and
+ os.path.normpath(self.prefix) != '/usr/local')
+ or sys.base_prefix != sys.prefix
+ or 'PYTHONUSERBASE' in os.environ
+ or 'VIRTUAL_ENV' in os.environ
+ or 'real_prefix' in sys.__dict__):
+ self.select_scheme("unix_prefix")
+ else:
+ if os.path.normpath(self.prefix) == '/usr/local':
+ self.prefix = self.exec_prefix = '/usr'
+ self.install_base = self.install_platbase = '/usr'
+ self.select_scheme("unix_local")
def finalize_other(self):
"""Finalizes options for non-posix platforms"""
Index: b/3.6/Lib/distutils/sysconfig.py
===================================================================
--- a/3.6/Lib/distutils/sysconfig.py
+++ b/3.6/Lib/distutils/sysconfig.py
@@ -122,6 +122,7 @@ def get_python_lib(plat_specific=0, stan
If 'prefix' is supplied, use it instead of sys.base_prefix or
sys.base_exec_prefix -- i.e., ignore 'plat_specific'.
"""
+ is_default_prefix = not prefix or os.path.normpath(prefix) in ('/usr', '/usr/local')
if prefix is None:
if standard_lib:
prefix = plat_specific and BASE_EXEC_PREFIX or BASE_PREFIX
@@ -133,6 +134,12 @@ def get_python_lib(plat_specific=0, stan
"lib", "python" + get_python_version())
if standard_lib:
return libpython
+ elif (is_default_prefix and
+ 'PYTHONUSERBASE' not in os.environ and
+ 'VIRTUAL_ENV' not in os.environ and
+ 'real_prefix' not in sys.__dict__ and
+ sys.prefix == sys.base_prefix):
+ return os.path.join(prefix, "lib", "python3", "dist-packages")
else:
return os.path.join(libpython, "site-packages")
elif os.name == "nt":
Index: b/3.6/Lib/distutils/tests/test_bdist_dumb.py
===================================================================
--- a/3.6/Lib/distutils/tests/test_bdist_dumb.py
+++ b/3.6/Lib/distutils/tests/test_bdist_dumb.py
@@ -85,7 +85,7 @@ class BuildDumbTestCase(support.TempdirM
fp.close()
contents = sorted(os.path.basename(fn) for fn in contents)
- wanted = ['foo-0.1-py%s.%s.egg-info' % sys.version_info[:2], 'foo.py']
+ wanted = ['foo-0.1.egg-info', 'foo.py']
if not sys.dont_write_bytecode:
wanted.append('foo.%s.pyc' % sys.implementation.cache_tag)
self.assertEqual(contents, sorted(wanted))
Index: b/3.6/Lib/distutils/tests/test_install.py
===================================================================
--- a/3.6/Lib/distutils/tests/test_install.py
+++ b/3.6/Lib/distutils/tests/test_install.py
@@ -193,7 +193,7 @@ class InstallTestCase(support.TempdirMan
found = [os.path.basename(line) for line in content.splitlines()]
expected = ['hello.py', 'hello.%s.pyc' % sys.implementation.cache_tag,
'sayhi',
- 'UNKNOWN-0.0.0-py%s.%s.egg-info' % sys.version_info[:2]]
+ 'UNKNOWN-0.0.0.egg-info']
self.assertEqual(found, expected)
def test_record_extensions(self):
@@ -226,7 +226,7 @@ class InstallTestCase(support.TempdirMan
found = [os.path.basename(line) for line in content.splitlines()]
expected = [_make_ext_name('xx'),
- 'UNKNOWN-0.0.0-py%s.%s.egg-info' % sys.version_info[:2]]
+ 'UNKNOWN-0.0.0.egg-info']
self.assertEqual(found, expected)
def test_debug_mode(self):
# DP: Don't add standard library dirs to library_dirs and runtime_library_dirs.
Index: b/3.6/Lib/distutils/unixccompiler.py
===================================================================
--- a/3.6/Lib/distutils/unixccompiler.py
+++ b/3.6/Lib/distutils/unixccompiler.py
@@ -155,6 +155,17 @@ class UnixCCompiler(CCompiler):
runtime_library_dirs)
libraries, library_dirs, runtime_library_dirs = fixed_args
+ # filter out standard library paths, which are not explicitely needed
+ # for linking
+ system_libdirs = ['/lib', '/lib64', '/usr/lib', '/usr/lib64']
+ multiarch = sysconfig.get_config_var("MULTIARCH")
+ if multiarch:
+ system_libdirs.extend(['/lib/%s' % multiarch, '/usr/lib/%s' % multiarch])
+ library_dirs = [dir for dir in library_dirs
+ if not dir in system_libdirs]
+ runtime_library_dirs = [dir for dir in runtime_library_dirs
+ if not dir in system_libdirs]
+
lib_opts = gen_lib_options(self, library_dirs, runtime_library_dirs,
libraries)
if not isinstance(output_dir, (str, type(None))):
# DP: Get CONFIGURE_CFLAGS, CONFIGURE_CPPFLAGS, CONFIGURE_LDFLAGS from
# DP: the python build, when CFLAGS, CPPFLAGS, LDSHARED) are not set
# DP: in the environment.
Index: b/3.6/Lib/distutils/sysconfig.py
===================================================================
--- a/3.6/Lib/distutils/sysconfig.py
+++ b/3.6/Lib/distutils/sysconfig.py
@@ -177,9 +177,11 @@ def customize_compiler(compiler):
_osx_support.customize_compiler(_config_vars)
_config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True'
- (cc, cxx, opt, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags) = \
+ (cc, cxx, opt, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags,
+ configure_cppflags, configure_cflags, configure_ldflags) = \
get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS',
- 'CCSHARED', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS')
+ 'CCSHARED', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS',
+ 'CONFIGURE_CPPFLAGS', 'CONFIGURE_CFLAGS', 'CONFIGURE_LDFLAGS')
if 'CC' in os.environ:
newcc = os.environ['CC']
@@ -200,13 +202,22 @@ def customize_compiler(compiler):
cpp = cc + " -E" # not always
if 'LDFLAGS' in os.environ:
ldshared = ldshared + ' ' + os.environ['LDFLAGS']
+ elif configure_ldflags:
+ ldshared = ldshared + ' ' + configure_ldflags
if 'CFLAGS' in os.environ:
cflags = opt + ' ' + os.environ['CFLAGS']
ldshared = ldshared + ' ' + os.environ['CFLAGS']
+ elif configure_cflags:
+ cflags = opt + ' ' + configure_cflags
+ ldshared = ldshared + ' ' + configure_cflags
if 'CPPFLAGS' in os.environ:
cpp = cpp + ' ' + os.environ['CPPFLAGS']
cflags = cflags + ' ' + os.environ['CPPFLAGS']
ldshared = ldshared + ' ' + os.environ['CPPFLAGS']
+ elif configure_cppflags:
+ cpp = cpp + ' ' + configure_cppflags
+ cflags = cflags + ' ' + configure_cppflags
+ ldshared = ldshared + ' ' + configure_cppflags
if 'AR' in os.environ:
ar = os.environ['AR']
if 'ARFLAGS' in os.environ:
# DP: Don't link extensions with the shared libpython library.
Index: b/3.6/Lib/distutils/command/build_ext.py
===================================================================
--- a/3.6/Lib/distutils/command/build_ext.py
+++ b/3.6/Lib/distutils/command/build_ext.py
@@ -230,7 +230,7 @@ class build_ext(Command):
# For building extensions with a shared Python library,
# Python's library directory must be appended to library_dirs
# See Issues: #1600860, #4366
- if (sysconfig.get_config_var('Py_ENABLE_SHARED')):
+ if False and (sysconfig.get_config_var('Py_ENABLE_SHARED')):
if not sysconfig.python_build:
# building third party extensions
self.library_dirs.append(sysconfig.get_config_var('LIBDIR'))
@@ -746,7 +746,7 @@ class build_ext(Command):
return ext.libraries
else:
from distutils import sysconfig
- if sysconfig.get_config_var('Py_ENABLE_SHARED'):
+ if False and sysconfig.get_config_var('Py_ENABLE_SHARED'):
pythonlib = 'python{}.{}{}'.format(
sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff,
sysconfig.get_config_var('ABIFLAGS'))
Index: b/3.6/Lib/lib2to3/pgen2/driver.py
===================================================================
--- a/3.6/Lib/lib2to3/pgen2/driver.py
+++ b/3.6/Lib/lib2to3/pgen2/driver.py
@@ -123,7 +123,10 @@ def load_grammar(gt="Grammar.txt", gp=No
if force or not _newer(gp, gt):
logger.info("Generating grammar tables from %s", gt)
g = pgen.generate_grammar(gt)
- if save:
+ # the pickle files mismatch, when built on different architectures.
+ # don't save these for now. An alternative solution might be to
+ # include the multiarch triplet into the file name
+ if False:
logger.info("Writing grammar tables to %s", gp)
try:
g.dump(gp)
# DP: When using GCC versions older than 4.9, automagically mangle
# DP: -fstack-protector-strong to -fstack-protector
Index: b/3.6/Lib/distutils/sysconfig.py
===================================================================
--- a/3.6/Lib/distutils/sysconfig.py
+++ b/3.6/Lib/distutils/sysconfig.py
@@ -13,6 +13,7 @@ import _imp
import os
import re
import sys
+import fnmatch
from .errors import DistutilsPlatformError
@@ -197,6 +198,10 @@ def customize_compiler(compiler):
cc = newcc
if 'CXX' in os.environ:
cxx = os.environ['CXX']
+ if fnmatch.filter([cc, cxx], '*-4.[0-8]'):
+ configure_cflags = configure_cflags.replace('-fstack-protector-strong', '-fstack-protector')
+ ldshared = ldshared.replace('-fstack-protector-strong', '-fstack-protector')
+ cflags = cflags.replace('-fstack-protector-strong', '-fstack-protector')
if 'LDSHARED' in os.environ:
ldshared = os.environ['LDSHARED']
if 'CPP' in os.environ:
# DP: Make sure to rename extensions to a tag including the MULTIARCH name
this patch can be dropped for python3.5 final, if the upstream chage is kept.
Index: b/3.6/Lib/distutils/dir_util.py
===================================================================
--- a/3.6/Lib/distutils/dir_util.py
+++ b/3.6/Lib/distutils/dir_util.py
@@ -96,6 +96,9 @@ def create_tree(base_dir, files, mode=0o
for dir in sorted(need_dir):
mkpath(dir, mode, verbose=verbose, dry_run=dry_run)
+import sysconfig
+_multiarch = None
+
def copy_tree(src, dst, preserve_mode=1, preserve_times=1,
preserve_symlinks=0, update=0, verbose=1, dry_run=0):
"""Copy an entire directory tree 'src' to a new location 'dst'.
@@ -131,6 +134,13 @@ def copy_tree(src, dst, preserve_mode=1,
raise DistutilsFileError(
"error listing files in '%s': %s" % (src, e.strerror))
+ ext_suffix = sysconfig.get_config_var ('EXT_SUFFIX')
+ _multiarch = sysconfig.get_config_var ('MULTIARCH')
+ if ext_suffix.endswith(_multiarch + ext_suffix[-3:]):
+ new_suffix = None
+ else:
+ new_suffix = "%s-%s%s" % (ext_suffix[:-3], _multiarch, ext_suffix[-3:])
+
if not dry_run:
mkpath(dst, verbose=verbose)
@@ -139,6 +149,9 @@ def copy_tree(src, dst, preserve_mode=1,
for n in names:
src_name = os.path.join(src, n)
dst_name = os.path.join(dst, n)
+ if new_suffix and _multiarch and n.endswith(ext_suffix) and not n.endswith(new_suffix):
+ dst_name = os.path.join(dst, n.replace(ext_suffix, new_suffix))
+ log.info("renaming extension %s -> %s", n, n.replace(ext_suffix, new_suffix))
if n.startswith('.nfs'):
# skip NFS rename files
Index: b/3.6/Lib/distutils/command/install_lib.py
===================================================================
--- a/3.6/Lib/distutils/command/install_lib.py
+++ b/3.6/Lib/distutils/command/install_lib.py
@@ -56,6 +56,7 @@ class install_lib(Command):
self.compile = None
self.optimize = None
self.skip_build = None
+ self.multiarch = None # if we should rename the extensions
def finalize_options(self):
# Get all the information we need to install pure Python modules
@@ -68,6 +69,7 @@ class install_lib(Command):
('compile', 'compile'),
('optimize', 'optimize'),
('skip_build', 'skip_build'),
+ ('multiarch', 'multiarch'),
)
if self.compile is None:
@@ -108,6 +110,8 @@ class install_lib(Command):
def install(self):
if os.path.isdir(self.build_dir):
+ import distutils.dir_util
+ distutils.dir_util._multiarch = self.multiarch
outfiles = self.copy_tree(self.build_dir, self.install_dir)
else:
self.warn("'%s' does not exist -- no Python modules to install" %
Index: b/3.6/Lib/distutils/command/install.py
===================================================================
--- a/3.6/Lib/distutils/command/install.py
+++ b/3.6/Lib/distutils/command/install.py
@@ -192,6 +192,7 @@ class install(Command):
# enable custom installation, known values: deb
self.install_layout = None
+ self.multiarch = None
self.compile = None
self.optimize = None
@@ -451,6 +452,8 @@ class install(Command):
self.install_platbase = self.exec_prefix
if self.install_layout:
if self.install_layout.lower() in ['deb']:
+ import sysconfig
+ self.multiarch = sysconfig.get_config_var('MULTIARCH')
self.select_scheme("deb_system")
elif self.install_layout.lower() in ['unix']:
self.select_scheme("unix_prefix")
Index: b/3.6/Lib/distutils/sysconfig.py
===================================================================
--- a/3.6/Lib/distutils/sysconfig.py
+++ b/3.6/Lib/distutils/sysconfig.py
@@ -99,6 +99,9 @@ def get_python_inc(plat_specific=0, pref
incdir = os.path.join(get_config_var('srcdir'), 'Include')
return os.path.normpath(incdir)
python_dir = 'python' + get_python_version() + build_flags
+ if not python_build and plat_specific:
+ import sysconfig
+ return sysconfig.get_path('platinclude')
return os.path.join(prefix, "include", python_dir)
elif os.name == "nt":
return os.path.join(prefix, "include")
# DP: suggest installation of the pythonX.Y-dev package, if bdist_wininst
# DP: cannot find the wininst-* files.
Index: b/3.7/Lib/distutils/command/bdist_wininst.py
===================================================================
--- a/3.7/Lib/distutils/command/bdist_wininst.py
+++ b/3.7/Lib/distutils/command/bdist_wininst.py
@@ -359,6 +359,10 @@ class bdist_wininst(Command):
filename = os.path.join(directory, "wininst-%s%s.exe" % (bv, sfix))
f = open(filename, "rb")
try:
+ f = open(filename, "rb")
+ except IOError as e:
+ raise DistutilsFileError(str(e) + ', %s not included in the Debian packages.' % filename)
+ try:
return f.read()
finally:
f.close()
# DP: Disable some failing tests we are not interested in
Index: b/3.7/Lib/distutils/tests/test_build_ext.py
===================================================================
--- a/3.7/Lib/distutils/tests/test_build_ext.py
+++ b/3.7/Lib/distutils/tests/test_build_ext.py
@@ -102,6 +102,7 @@ class BuildExtTestCase(TempdirManager,
self.assertIsInstance(xx.Null(), xx.Null)
self.assertIsInstance(xx.Str(), xx.Str)
+ @unittest.skip('Skipping failing Solaris test')
def test_solaris_enable_shared(self):
dist = Distribution({'name': 'xx'})
cmd = self.build_ext(dist)
# DP: distutils: Add an option --install-layout=deb, which
# DP: - installs into $prefix/dist-packages instead of $prefix/site-packages.
# DP: - doesn't encode the python version into the egg name.
Index: b/3.7/Lib/distutils/command/install_egg_info.py
===================================================================
--- a/3.7/Lib/distutils/command/install_egg_info.py
+++ b/3.7/Lib/distutils/command/install_egg_info.py
@@ -14,18 +14,38 @@ class install_egg_info(Command):
description = "Install package's PKG-INFO metadata as an .egg-info file"
user_options = [
('install-dir=', 'd', "directory to install to"),
+ ('install-layout', None, "custom installation layout"),
]
def initialize_options(self):
self.install_dir = None
+ self.install_layout = None
+ self.prefix_option = None
def finalize_options(self):
self.set_undefined_options('install_lib',('install_dir','install_dir'))
- basename = "%s-%s-py%d.%d.egg-info" % (
- to_filename(safe_name(self.distribution.get_name())),
- to_filename(safe_version(self.distribution.get_version())),
- *sys.version_info[:2]
- )
+ self.set_undefined_options('install',('install_layout','install_layout'))
+ self.set_undefined_options('install',('prefix_option','prefix_option'))
+ if self.install_layout:
+ if not self.install_layout.lower() in ['deb', 'unix']:
+ raise DistutilsOptionError(
+ "unknown value for --install-layout")
+ no_pyver = (self.install_layout.lower() == 'deb')
+ elif self.prefix_option:
+ no_pyver = False
+ else:
+ no_pyver = True
+ if no_pyver:
+ basename = "%s-%s.egg-info" % (
+ to_filename(safe_name(self.distribution.get_name())),
+ to_filename(safe_version(self.distribution.get_version()))
+ )
+ else:
+ basename = "%s-%s-py%d.%d.egg-info" % (
+ to_filename(safe_name(self.distribution.get_name())),
+ to_filename(safe_version(self.distribution.get_version())),
+ *sys.version_info[:2]
+ )
self.target = os.path.join(self.install_dir, basename)
self.outputs = [self.target]
Index: b/3.7/Lib/distutils/command/install.py
===================================================================
--- a/3.7/Lib/distutils/command/install.py
+++ b/3.7/Lib/distutils/command/install.py
@@ -35,6 +35,20 @@ INSTALL_SCHEMES = {
'scripts': '$base/bin',
'data' : '$base',
},
+ 'unix_local': {
+ 'purelib': '$base/local/lib/python$py_version_short/dist-packages',
+ 'platlib': '$platbase/local/lib/python$py_version_short/dist-packages',
+ 'headers': '$base/local/include/python$py_version_short/$dist_name',
+ 'scripts': '$base/local/bin',
+ 'data' : '$base/local',
+ },
+ 'deb_system': {
+ 'purelib': '$base/lib/python3/dist-packages',
+ 'platlib': '$platbase/lib/python3/dist-packages',
+ 'headers': '$base/include/python$py_version_short/$dist_name',
+ 'scripts': '$base/bin',
+ 'data' : '$base',
+ },
'unix_home': {
'purelib': '$base/lib/python',
'platlib': '$base/lib/python',
@@ -131,6 +145,9 @@ class install(Command):
('record=', None,
"filename in which to record list of installed files"),
+
+ ('install-layout=', None,
+ "installation layout to choose (known values: deb, unix)"),
]
boolean_options = ['compile', 'force', 'skip-build']
@@ -151,6 +168,7 @@ class install(Command):
self.exec_prefix = None
self.home = None
self.user = 0
+ self.prefix_option = None
# These select only the installation base; it's up to the user to
# specify the installation scheme (currently, that means supplying
@@ -172,6 +190,9 @@ class install(Command):
self.install_userbase = USER_BASE
self.install_usersite = USER_SITE