Skip to content

Commit

Permalink
Merge pull request #3062 from pypa/distutils-b53a824ec3
Browse files Browse the repository at this point in the history
Merge with distutils b53a824
  • Loading branch information
jaraco authored Jan 31, 2022
2 parents e996c28 + 44649c5 commit 1ae32a3
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 13 deletions.
1 change: 1 addition & 0 deletions changelog.d/3062.change.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Merge with pypa/distutils@b53a824ec3 including improved support for lib directories on non-x64 Windows builds.
2 changes: 1 addition & 1 deletion setuptools/_distutils/_msvccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ class MSVCCompiler(CCompiler) :


def __init__(self, verbose=0, dry_run=0, force=0):
CCompiler.__init__ (self, verbose, dry_run, force)
super().__init__(verbose, dry_run, force)
# target platform (.plat_name is consistent with 'bdist')
self.plat_name = None
self.initialized = False
Expand Down
2 changes: 1 addition & 1 deletion setuptools/_distutils/bcppcompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def __init__ (self,
dry_run=0,
force=0):

CCompiler.__init__ (self, verbose, dry_run, force)
super().__init__(verbose, dry_run, force)

# These executables are assumed to all be in the path.
# Borland doesn't seem to use any special registry settings to
Expand Down
2 changes: 1 addition & 1 deletion setuptools/_distutils/command/bdist_msi.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class PyDialog(Dialog):
def __init__(self, *args, **kw):
"""Dialog(database, name, x, y, w, h, attributes, title, first,
default, cancel, bitmap=true)"""
Dialog.__init__(self, *args)
super().__init__(*args)
ruler = self.h - 36
bmwidth = 152*ruler/328
#if kw.get("bitmap", True):
Expand Down
2 changes: 1 addition & 1 deletion setuptools/_distutils/command/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class SilentReporter(Reporter):
def __init__(self, source, report_level, halt_level, stream=None,
debug=0, encoding='ascii', error_handler='replace'):
self.messages = []
Reporter.__init__(self, source, report_level, halt_level, stream,
super().__init__(source, report_level, halt_level, stream,
debug, encoding, error_handler)

def system_message(self, level, message, *children, **kwargs):
Expand Down
12 changes: 9 additions & 3 deletions setuptools/_distutils/command/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@
INSTALL_SCHEMES['nt_user'] = {
'purelib': '{usersite}',
'platlib': '{usersite}',
'headers': '{userbase}/{implementation}{py_version_nodot}/Include/{dist_name}',
'scripts': '{userbase}/{implementation}{py_version_nodot}/Scripts',
'headers': '{userbase}/{implementation}{py_version_nodot_plat}/Include/{dist_name}',
'scripts': '{userbase}/{implementation}{py_version_nodot_plat}/Scripts',
'data' : '{userbase}',
}

Expand Down Expand Up @@ -412,12 +412,18 @@ def finalize_options(self):
'implementation': _get_implementation(),
}

# vars for compatibility on older Pythons
compat_vars = dict(
# Python 3.9 and earlier
py_version_nodot_plat=getattr(sys, 'winver', '').replace('.', ''),
)

if HAS_USER_SITE:
local_vars['userbase'] = self.install_userbase
local_vars['usersite'] = self.install_usersite

self.config_vars = _collections.DictStack(
[sysconfig.get_config_vars(), local_vars])
[compat_vars, sysconfig.get_config_vars(), local_vars])

self.expand_basedirs()

Expand Down
4 changes: 2 additions & 2 deletions setuptools/_distutils/cygwinccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class CygwinCCompiler(UnixCCompiler):

def __init__(self, verbose=0, dry_run=0, force=0):

UnixCCompiler.__init__(self, verbose, dry_run, force)
super().__init__(verbose, dry_run, force)

status, details = check_config_h()
self.debug_print("Python's GCC status: %s (details: %s)" %
Expand Down Expand Up @@ -268,7 +268,7 @@ class Mingw32CCompiler(CygwinCCompiler):

def __init__(self, verbose=0, dry_run=0, force=0):

CygwinCCompiler.__init__ (self, verbose, dry_run, force)
super().__init__ (verbose, dry_run, force)

shared_option = "-shared"

Expand Down
2 changes: 1 addition & 1 deletion setuptools/_distutils/msvc9compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ class MSVCCompiler(CCompiler) :
exe_extension = '.exe'

def __init__(self, verbose=0, dry_run=0, force=0):
CCompiler.__init__ (self, verbose, dry_run, force)
super().__init__(verbose, dry_run, force)
self.__version = VERSION
self.__root = r"Software\Microsoft\VisualStudio"
# self.__macros = MACROS
Expand Down
2 changes: 1 addition & 1 deletion setuptools/_distutils/msvccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ class MSVCCompiler(CCompiler) :
exe_extension = '.exe'

def __init__(self, verbose=0, dry_run=0, force=0):
CCompiler.__init__ (self, verbose, dry_run, force)
super().__init__(verbose, dry_run, force)
self.__version = get_build_version()
self.__arch = get_build_architecture()
if self.__arch == "Intel":
Expand Down
2 changes: 1 addition & 1 deletion setuptools/_distutils/tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def setUp(self):

class command(PyPIRCCommand):
def __init__(self, dist):
PyPIRCCommand.__init__(self, dist)
super().__init__(dist)
def initialize_options(self):
pass
finalize_options = initialize_options
Expand Down
15 changes: 14 additions & 1 deletion setuptools/_distutils/tests/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ def test_user_site(self):
install_module.USER_SITE = self.user_site

def _expanduser(path):
return self.tmpdir
if path.startswith('~'):
return os.path.normpath(self.tmpdir + path[1:])
return path
self.old_expand = os.path.expanduser
os.path.expanduser = _expanduser

Expand Down Expand Up @@ -122,6 +124,17 @@ def cleanup():
self.assertIn('userbase', cmd.config_vars)
self.assertIn('usersite', cmd.config_vars)

actual_headers = os.path.relpath(cmd.install_headers, self.user_base)
if os.name == 'nt':
site_path = os.path.relpath(
os.path.dirname(self.old_user_site), self.old_user_base)
include = os.path.join(site_path, 'Include')
else:
include = sysconfig.get_python_inc(0, '')
expect_headers = os.path.join(include, 'xx')

self.assertEqual(os.path.normcase(actual_headers), os.path.normcase(expect_headers))

def test_handle_extra_path(self):
dist = Distribution({'name': 'xx', 'extra_path': 'path,dirs'})
cmd = install(dist)
Expand Down
6 changes: 6 additions & 0 deletions setuptools/command/easy_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,12 @@ def finalize_options(self): # noqa: C901 # is too complex (25) # FIXME
'implementation': install._get_implementation(),
})

# pypa/distutils#113 Python 3.9 compat
self.config_vars.setdefault(
'py_version_nodot_plat',
getattr(sys, 'windir', '').replace('.', ''),
)

if site.ENABLE_USER_SITE:
self.config_vars['userbase'] = self.install_userbase
self.config_vars['usersite'] = self.install_usersite
Expand Down

0 comments on commit 1ae32a3

Please sign in to comment.