py2docfx 0.1.11.dev1824276__py3-none-any.whl → 0.1.11.dev1830301__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. py2docfx/convert_prepare/environment.py +1 -1
  2. py2docfx/convert_prepare/package_info.py +1 -1
  3. py2docfx/convert_prepare/pip_utils.py +1 -1
  4. py2docfx/convert_prepare/tests/test_package_info.py +7 -22
  5. py2docfx/convert_prepare/tests/test_params.py +5 -0
  6. py2docfx/venv/0/Lib/site-packages/setuptools/_distutils/_collections.py +0 -145
  7. py2docfx/venv/0/Lib/site-packages/setuptools/_distutils/bcppcompiler.py +1 -2
  8. py2docfx/venv/0/Lib/site-packages/setuptools/_distutils/ccompiler.py +7 -11
  9. py2docfx/venv/0/Lib/site-packages/setuptools/_distutils/command/bdist.py +4 -3
  10. py2docfx/venv/0/Lib/site-packages/setuptools/_distutils/command/build_ext.py +1 -4
  11. py2docfx/venv/0/Lib/site-packages/setuptools/_distutils/command/check.py +3 -4
  12. py2docfx/venv/0/Lib/site-packages/setuptools/_distutils/command/install_data.py +39 -29
  13. py2docfx/venv/0/Lib/site-packages/setuptools/_distutils/command/install_lib.py +1 -3
  14. py2docfx/venv/0/Lib/site-packages/setuptools/_distutils/command/sdist.py +4 -4
  15. py2docfx/venv/0/Lib/site-packages/setuptools/_distutils/compat/py38.py +1 -0
  16. py2docfx/venv/0/Lib/site-packages/setuptools/_distutils/cygwinccompiler.py +21 -42
  17. py2docfx/venv/0/Lib/site-packages/setuptools/_distutils/dist.py +3 -12
  18. py2docfx/venv/0/Lib/site-packages/setuptools/_distutils/extension.py +9 -4
  19. py2docfx/venv/0/Lib/site-packages/setuptools/_distutils/msvc9compiler.py +1 -3
  20. py2docfx/venv/0/Lib/site-packages/setuptools/_distutils/msvccompiler.py +1 -3
  21. py2docfx/venv/0/Lib/site-packages/setuptools/_distutils/spawn.py +0 -1
  22. py2docfx/venv/0/Lib/site-packages/setuptools/_distutils/sysconfig.py +44 -25
  23. py2docfx/venv/0/Lib/site-packages/setuptools/_distutils/tests/test_archive_util.py +1 -1
  24. py2docfx/venv/0/Lib/site-packages/setuptools/_distutils/tests/test_build.py +1 -2
  25. py2docfx/venv/0/Lib/site-packages/setuptools/_distutils/tests/test_build_ext.py +1 -1
  26. py2docfx/venv/0/Lib/site-packages/setuptools/_distutils/tests/test_cygwinccompiler.py +0 -42
  27. py2docfx/venv/0/Lib/site-packages/setuptools/_distutils/tests/test_dist.py +1 -1
  28. py2docfx/venv/0/Lib/site-packages/setuptools/_distutils/tests/test_extension.py +4 -1
  29. py2docfx/venv/0/Lib/site-packages/setuptools/_distutils/tests/test_install_data.py +17 -9
  30. py2docfx/venv/0/Lib/site-packages/setuptools/_distutils/tests/test_mingwccompiler.py +5 -4
  31. py2docfx/venv/0/Lib/site-packages/setuptools/_distutils/tests/test_spawn.py +1 -1
  32. py2docfx/venv/0/Lib/site-packages/setuptools/_distutils/tests/test_sysconfig.py +6 -3
  33. py2docfx/venv/0/Lib/site-packages/setuptools/_distutils/tests/test_unixccompiler.py +35 -1
  34. py2docfx/venv/0/Lib/site-packages/setuptools/_distutils/tests/test_util.py +4 -24
  35. py2docfx/venv/0/Lib/site-packages/setuptools/_distutils/unixccompiler.py +19 -20
  36. py2docfx/venv/0/Lib/site-packages/setuptools/_distutils/util.py +20 -26
  37. py2docfx/venv/0/Lib/site-packages/wheel/__init__.py +3 -0
  38. py2docfx/venv/0/Lib/site-packages/wheel/__main__.py +23 -0
  39. py2docfx/venv/0/Lib/site-packages/wheel/_bdist_wheel.py +604 -0
  40. py2docfx/venv/0/Lib/site-packages/wheel/_setuptools_logging.py +26 -0
  41. py2docfx/venv/0/Lib/site-packages/wheel/bdist_wheel.py +11 -0
  42. py2docfx/venv/0/Lib/site-packages/wheel/cli/__init__.py +155 -0
  43. py2docfx/venv/0/Lib/site-packages/wheel/cli/convert.py +273 -0
  44. py2docfx/venv/0/Lib/site-packages/wheel/cli/pack.py +85 -0
  45. py2docfx/venv/0/Lib/site-packages/wheel/cli/tags.py +139 -0
  46. py2docfx/venv/0/Lib/site-packages/wheel/cli/unpack.py +30 -0
  47. py2docfx/venv/0/Lib/site-packages/wheel/macosx_libfile.py +482 -0
  48. py2docfx/venv/0/Lib/site-packages/wheel/metadata.py +183 -0
  49. py2docfx/venv/0/Lib/site-packages/wheel/util.py +26 -0
  50. py2docfx/venv/0/Lib/site-packages/wheel/vendored/__init__.py +0 -0
  51. py2docfx/venv/0/Lib/site-packages/wheel/vendored/packaging/__init__.py +0 -0
  52. py2docfx/venv/0/Lib/site-packages/wheel/vendored/packaging/_elffile.py +108 -0
  53. py2docfx/venv/0/Lib/site-packages/wheel/vendored/packaging/_manylinux.py +260 -0
  54. py2docfx/venv/0/Lib/site-packages/wheel/vendored/packaging/_musllinux.py +83 -0
  55. py2docfx/venv/0/Lib/site-packages/wheel/vendored/packaging/_parser.py +356 -0
  56. py2docfx/venv/0/Lib/site-packages/wheel/vendored/packaging/_structures.py +61 -0
  57. py2docfx/venv/0/Lib/site-packages/wheel/vendored/packaging/_tokenizer.py +192 -0
  58. py2docfx/venv/0/Lib/site-packages/wheel/vendored/packaging/markers.py +253 -0
  59. py2docfx/venv/0/Lib/site-packages/wheel/vendored/packaging/requirements.py +90 -0
  60. py2docfx/venv/0/Lib/site-packages/wheel/vendored/packaging/specifiers.py +1011 -0
  61. py2docfx/venv/0/Lib/site-packages/wheel/vendored/packaging/tags.py +571 -0
  62. py2docfx/venv/0/Lib/site-packages/wheel/vendored/packaging/utils.py +172 -0
  63. py2docfx/venv/0/Lib/site-packages/wheel/vendored/packaging/version.py +561 -0
  64. py2docfx/venv/0/Lib/site-packages/wheel/wheelfile.py +227 -0
  65. py2docfx/venv/template/Lib/site-packages/setuptools/_distutils/_collections.py +0 -145
  66. py2docfx/venv/template/Lib/site-packages/setuptools/_distutils/bcppcompiler.py +1 -2
  67. py2docfx/venv/template/Lib/site-packages/setuptools/_distutils/ccompiler.py +7 -11
  68. py2docfx/venv/template/Lib/site-packages/setuptools/_distutils/command/bdist.py +4 -3
  69. py2docfx/venv/template/Lib/site-packages/setuptools/_distutils/command/build_ext.py +1 -4
  70. py2docfx/venv/template/Lib/site-packages/setuptools/_distutils/command/check.py +3 -4
  71. py2docfx/venv/template/Lib/site-packages/setuptools/_distutils/command/install_data.py +39 -29
  72. py2docfx/venv/template/Lib/site-packages/setuptools/_distutils/command/install_lib.py +1 -3
  73. py2docfx/venv/template/Lib/site-packages/setuptools/_distutils/command/sdist.py +4 -4
  74. py2docfx/venv/template/Lib/site-packages/setuptools/_distutils/compat/py38.py +1 -0
  75. py2docfx/venv/template/Lib/site-packages/setuptools/_distutils/cygwinccompiler.py +21 -42
  76. py2docfx/venv/template/Lib/site-packages/setuptools/_distutils/dist.py +3 -12
  77. py2docfx/venv/template/Lib/site-packages/setuptools/_distutils/extension.py +9 -4
  78. py2docfx/venv/template/Lib/site-packages/setuptools/_distutils/msvc9compiler.py +1 -3
  79. py2docfx/venv/template/Lib/site-packages/setuptools/_distutils/msvccompiler.py +1 -3
  80. py2docfx/venv/template/Lib/site-packages/setuptools/_distutils/spawn.py +0 -1
  81. py2docfx/venv/template/Lib/site-packages/setuptools/_distutils/sysconfig.py +44 -25
  82. py2docfx/venv/template/Lib/site-packages/setuptools/_distutils/tests/test_archive_util.py +1 -1
  83. py2docfx/venv/template/Lib/site-packages/setuptools/_distutils/tests/test_build.py +1 -2
  84. py2docfx/venv/template/Lib/site-packages/setuptools/_distutils/tests/test_build_ext.py +1 -1
  85. py2docfx/venv/template/Lib/site-packages/setuptools/_distutils/tests/test_cygwinccompiler.py +0 -42
  86. py2docfx/venv/template/Lib/site-packages/setuptools/_distutils/tests/test_dist.py +1 -1
  87. py2docfx/venv/template/Lib/site-packages/setuptools/_distutils/tests/test_extension.py +4 -1
  88. py2docfx/venv/template/Lib/site-packages/setuptools/_distutils/tests/test_install_data.py +17 -9
  89. py2docfx/venv/template/Lib/site-packages/setuptools/_distutils/tests/test_mingwccompiler.py +5 -4
  90. py2docfx/venv/template/Lib/site-packages/setuptools/_distutils/tests/test_spawn.py +1 -1
  91. py2docfx/venv/template/Lib/site-packages/setuptools/_distutils/tests/test_sysconfig.py +6 -3
  92. py2docfx/venv/template/Lib/site-packages/setuptools/_distutils/tests/test_unixccompiler.py +35 -1
  93. py2docfx/venv/template/Lib/site-packages/setuptools/_distutils/tests/test_util.py +4 -24
  94. py2docfx/venv/template/Lib/site-packages/setuptools/_distutils/unixccompiler.py +19 -20
  95. py2docfx/venv/template/Lib/site-packages/setuptools/_distutils/util.py +20 -26
  96. py2docfx/venv/template/Lib/site-packages/wheel/__init__.py +3 -0
  97. py2docfx/venv/template/Lib/site-packages/wheel/__main__.py +23 -0
  98. py2docfx/venv/template/Lib/site-packages/wheel/_bdist_wheel.py +604 -0
  99. py2docfx/venv/template/Lib/site-packages/wheel/_setuptools_logging.py +26 -0
  100. py2docfx/venv/template/Lib/site-packages/wheel/bdist_wheel.py +11 -0
  101. py2docfx/venv/template/Lib/site-packages/wheel/cli/__init__.py +155 -0
  102. py2docfx/venv/template/Lib/site-packages/wheel/cli/convert.py +273 -0
  103. py2docfx/venv/template/Lib/site-packages/wheel/cli/pack.py +85 -0
  104. py2docfx/venv/template/Lib/site-packages/wheel/cli/tags.py +139 -0
  105. py2docfx/venv/template/Lib/site-packages/wheel/cli/unpack.py +30 -0
  106. py2docfx/venv/template/Lib/site-packages/wheel/macosx_libfile.py +482 -0
  107. py2docfx/venv/template/Lib/site-packages/wheel/metadata.py +183 -0
  108. py2docfx/venv/template/Lib/site-packages/wheel/util.py +26 -0
  109. py2docfx/venv/template/Lib/site-packages/wheel/vendored/__init__.py +0 -0
  110. py2docfx/venv/template/Lib/site-packages/wheel/vendored/packaging/__init__.py +0 -0
  111. py2docfx/venv/template/Lib/site-packages/wheel/vendored/packaging/_elffile.py +108 -0
  112. py2docfx/venv/template/Lib/site-packages/wheel/vendored/packaging/_manylinux.py +260 -0
  113. py2docfx/venv/template/Lib/site-packages/wheel/vendored/packaging/_musllinux.py +83 -0
  114. py2docfx/venv/template/Lib/site-packages/wheel/vendored/packaging/_parser.py +356 -0
  115. py2docfx/venv/template/Lib/site-packages/wheel/vendored/packaging/_structures.py +61 -0
  116. py2docfx/venv/template/Lib/site-packages/wheel/vendored/packaging/_tokenizer.py +192 -0
  117. py2docfx/venv/template/Lib/site-packages/wheel/vendored/packaging/markers.py +253 -0
  118. py2docfx/venv/template/Lib/site-packages/wheel/vendored/packaging/requirements.py +90 -0
  119. py2docfx/venv/template/Lib/site-packages/wheel/vendored/packaging/specifiers.py +1011 -0
  120. py2docfx/venv/template/Lib/site-packages/wheel/vendored/packaging/tags.py +571 -0
  121. py2docfx/venv/template/Lib/site-packages/wheel/vendored/packaging/utils.py +172 -0
  122. py2docfx/venv/template/Lib/site-packages/wheel/vendored/packaging/version.py +561 -0
  123. py2docfx/venv/template/Lib/site-packages/wheel/wheelfile.py +227 -0
  124. {py2docfx-0.1.11.dev1824276.dist-info → py2docfx-0.1.11.dev1830301.dist-info}/METADATA +1 -1
  125. {py2docfx-0.1.11.dev1824276.dist-info → py2docfx-0.1.11.dev1830301.dist-info}/RECORD +127 -71
  126. {py2docfx-0.1.11.dev1824276.dist-info → py2docfx-0.1.11.dev1830301.dist-info}/WHEEL +0 -0
  127. {py2docfx-0.1.11.dev1824276.dist-info → py2docfx-0.1.11.dev1830301.dist-info}/top_level.txt +0 -0
@@ -534,9 +534,7 @@ class MSVCCompiler(CCompiler):
534
534
  else:
535
535
  ldflags = self.ldflags_shared
536
536
 
537
- export_opts = []
538
- for sym in export_symbols or []:
539
- export_opts.append("/EXPORT:" + sym)
537
+ export_opts = [f"/EXPORT:{sym}" for sym in export_symbols or []]
540
538
 
541
539
  ld_args = (
542
540
  ldflags + lib_opts + export_opts + objects + ['/OUT:' + output_filename]
@@ -12,7 +12,6 @@ import shutil
12
12
  import subprocess
13
13
  import sys
14
14
  import warnings
15
-
16
15
  from typing import Mapping
17
16
 
18
17
  from ._log import log
@@ -287,7 +287,7 @@ def _customize_macos():
287
287
  )
288
288
 
289
289
 
290
- def customize_compiler(compiler): # noqa: C901
290
+ def customize_compiler(compiler):
291
291
  """Do any platform-specific customization of a CCompiler instance.
292
292
 
293
293
  Mainly needed on Unix, so we can plug in the information that
@@ -304,6 +304,7 @@ def customize_compiler(compiler): # noqa: C901
304
304
  cflags,
305
305
  ccshared,
306
306
  ldshared,
307
+ ldcxxshared,
307
308
  shlib_suffix,
308
309
  ar,
309
310
  ar_flags,
@@ -313,11 +314,14 @@ def customize_compiler(compiler): # noqa: C901
313
314
  'CFLAGS',
314
315
  'CCSHARED',
315
316
  'LDSHARED',
317
+ 'LDCXXSHARED',
316
318
  'SHLIB_SUFFIX',
317
319
  'AR',
318
320
  'ARFLAGS',
319
321
  )
320
322
 
323
+ cxxflags = cflags
324
+
321
325
  if 'CC' in os.environ:
322
326
  newcc = os.environ['CC']
323
327
  if 'LDSHARED' not in os.environ and ldshared.startswith(cc):
@@ -325,38 +329,42 @@ def customize_compiler(compiler): # noqa: C901
325
329
  # command for LDSHARED as well
326
330
  ldshared = newcc + ldshared[len(cc) :]
327
331
  cc = newcc
328
- if 'CXX' in os.environ:
329
- cxx = os.environ['CXX']
330
- if 'LDSHARED' in os.environ:
331
- ldshared = os.environ['LDSHARED']
332
- if 'CPP' in os.environ:
333
- cpp = os.environ['CPP']
334
- else:
335
- cpp = cc + " -E" # not always
336
- if 'LDFLAGS' in os.environ:
337
- ldshared = ldshared + ' ' + os.environ['LDFLAGS']
338
- if 'CFLAGS' in os.environ:
339
- cflags = cflags + ' ' + os.environ['CFLAGS']
340
- ldshared = ldshared + ' ' + os.environ['CFLAGS']
341
- if 'CPPFLAGS' in os.environ:
342
- cpp = cpp + ' ' + os.environ['CPPFLAGS']
343
- cflags = cflags + ' ' + os.environ['CPPFLAGS']
344
- ldshared = ldshared + ' ' + os.environ['CPPFLAGS']
345
- if 'AR' in os.environ:
346
- ar = os.environ['AR']
347
- if 'ARFLAGS' in os.environ:
348
- archiver = ar + ' ' + os.environ['ARFLAGS']
349
- else:
350
- archiver = ar + ' ' + ar_flags
332
+ cxx = os.environ.get('CXX', cxx)
333
+ ldshared = os.environ.get('LDSHARED', ldshared)
334
+ ldcxxshared = os.environ.get('LDCXXSHARED', ldcxxshared)
335
+ cpp = os.environ.get(
336
+ 'CPP',
337
+ cc + " -E", # not always
338
+ )
351
339
 
340
+ ldshared = _add_flags(ldshared, 'LD')
341
+ ldcxxshared = _add_flags(ldcxxshared, 'LD')
342
+ cflags = _add_flags(cflags, 'C')
343
+ ldshared = _add_flags(ldshared, 'C')
344
+ cxxflags = os.environ.get('CXXFLAGS', cxxflags)
345
+ ldcxxshared = _add_flags(ldcxxshared, 'CXX')
346
+ cpp = _add_flags(cpp, 'CPP')
347
+ cflags = _add_flags(cflags, 'CPP')
348
+ cxxflags = _add_flags(cxxflags, 'CPP')
349
+ ldshared = _add_flags(ldshared, 'CPP')
350
+ ldcxxshared = _add_flags(ldcxxshared, 'CPP')
351
+
352
+ ar = os.environ.get('AR', ar)
353
+
354
+ archiver = ar + ' ' + os.environ.get('ARFLAGS', ar_flags)
352
355
  cc_cmd = cc + ' ' + cflags
356
+ cxx_cmd = cxx + ' ' + cxxflags
357
+
353
358
  compiler.set_executables(
354
359
  preprocessor=cpp,
355
360
  compiler=cc_cmd,
356
361
  compiler_so=cc_cmd + ' ' + ccshared,
357
- compiler_cxx=cxx,
362
+ compiler_cxx=cxx_cmd,
363
+ compiler_so_cxx=cxx_cmd + ' ' + ccshared,
358
364
  linker_so=ldshared,
365
+ linker_so_cxx=ldcxxshared,
359
366
  linker_exe=cc,
367
+ linker_exe_cxx=cxx,
360
368
  archiver=archiver,
361
369
  )
362
370
 
@@ -561,3 +569,14 @@ def get_config_var(name):
561
569
 
562
570
  warnings.warn('SO is deprecated, use EXT_SUFFIX', DeprecationWarning, 2)
563
571
  return get_config_vars().get(name)
572
+
573
+
574
+ @pass_none
575
+ def _add_flags(value: str, type: str) -> str:
576
+ """
577
+ Add any flags from the environment for the given type.
578
+
579
+ type is the prefix to FLAGS in the environment key (e.g. "C" for "CFLAGS").
580
+ """
581
+ flags = os.environ.get(f'{type}FLAGS')
582
+ return f'{value} {flags}' if flags else value
@@ -18,10 +18,10 @@ from distutils.archive_util import (
18
18
  from distutils.spawn import spawn
19
19
  from distutils.tests import support
20
20
  from os.path import splitdrive
21
- from test.support import patch
22
21
 
23
22
  import path
24
23
  import pytest
24
+ from test.support import patch
25
25
 
26
26
  from .compat.py38 import check_warnings
27
27
  from .unix_compat import UID_0_SUPPORT, grp, pwd, require_uid_0, require_unix_id
@@ -4,8 +4,7 @@ import os
4
4
  import sys
5
5
  from distutils.command.build import build
6
6
  from distutils.tests import support
7
- from sysconfig import get_config_var
8
- from sysconfig import get_platform
7
+ from sysconfig import get_config_var, get_platform
9
8
 
10
9
 
11
10
  class TestBuild(support.TempdirManager):
@@ -25,11 +25,11 @@ from distutils.tests.support import (
25
25
  fixup_build_ext,
26
26
  )
27
27
  from io import StringIO
28
- from test import support
29
28
 
30
29
  import jaraco.path
31
30
  import path
32
31
  import pytest
32
+ from test import support
33
33
 
34
34
  from .compat import py38 as import_helper
35
35
 
@@ -71,50 +71,8 @@ class TestCygwinCCompiler(support.TempdirManager):
71
71
  assert check_config_h()[0] == CONFIG_H_OK
72
72
 
73
73
  def test_get_msvcr(self):
74
- # []
75
- sys.version = (
76
- '2.6.1 (r261:67515, Dec 6 2008, 16:42:21) '
77
- '\n[GCC 4.0.1 (Apple Computer, Inc. build 5370)]'
78
- )
79
74
  assert get_msvcr() == []
80
75
 
81
- # MSVC 7.0
82
- sys.version = (
83
- '2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1300 32 bits (Intel)]'
84
- )
85
- assert get_msvcr() == ['msvcr70']
86
-
87
- # MSVC 7.1
88
- sys.version = (
89
- '2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bits (Intel)]'
90
- )
91
- assert get_msvcr() == ['msvcr71']
92
-
93
- # VS2005 / MSVC 8.0
94
- sys.version = (
95
- '2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1400 32 bits (Intel)]'
96
- )
97
- assert get_msvcr() == ['msvcr80']
98
-
99
- # VS2008 / MSVC 9.0
100
- sys.version = (
101
- '2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1500 32 bits (Intel)]'
102
- )
103
- assert get_msvcr() == ['msvcr90']
104
-
105
- sys.version = (
106
- '3.10.0 (tags/v3.10.0:b494f59, Oct 4 2021, 18:46:30) '
107
- '[MSC v.1929 32 bit (Intel)]'
108
- )
109
- assert get_msvcr() == ['vcruntime140']
110
-
111
- # unknown
112
- sys.version = (
113
- '2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.2000 32 bits (Intel)]'
114
- )
115
- with pytest.raises(ValueError):
116
- get_msvcr()
117
-
118
76
  @pytest.mark.skipif('sys.platform != "cygwin"')
119
77
  def test_dll_libraries_not_none(self):
120
78
  from distutils.cygwinccompiler import CygwinCCompiler
@@ -88,7 +88,7 @@ class TestDistributionBehavior(support.TempdirManager):
88
88
  'distutils' not in Distribution.parse_config_files.__module__,
89
89
  reason='Cannot test when virtualenv has monkey-patched Distribution',
90
90
  )
91
- def test_venv_install_options(self, tmp_path):
91
+ def test_venv_install_options(self, tmp_path, clear_argv):
92
92
  sys.argv.append("install")
93
93
  file = str(tmp_path / 'file')
94
94
 
@@ -1,6 +1,7 @@
1
1
  """Tests for distutils.extension."""
2
2
 
3
3
  import os
4
+ import pathlib
4
5
  import warnings
5
6
  from distutils.extension import Extension, read_setup_file
6
7
 
@@ -68,13 +69,15 @@ class TestExtension:
68
69
  assert ext.name == 'name'
69
70
 
70
71
  # the second argument, which is the list of files, must
71
- # be a list of strings
72
+ # be a list of strings or PathLike objects
72
73
  with pytest.raises(AssertionError):
73
74
  Extension('name', 'file')
74
75
  with pytest.raises(AssertionError):
75
76
  Extension('name', ['file', 1])
76
77
  ext = Extension('name', ['file1', 'file2'])
77
78
  assert ext.sources == ['file1', 'file2']
79
+ ext = Extension('name', [pathlib.Path('file1'), pathlib.Path('file2')])
80
+ assert ext.sources == ['file1', 'file2']
78
81
 
79
82
  # others arguments have defaults
80
83
  for attr in (
@@ -1,6 +1,7 @@
1
1
  """Tests for distutils.command.install_data."""
2
2
 
3
3
  import os
4
+ import pathlib
4
5
  from distutils.command.install_data import install_data
5
6
  from distutils.tests import support
6
7
 
@@ -18,22 +19,27 @@ class TestInstallData(
18
19
 
19
20
  # data_files can contain
20
21
  # - simple files
22
+ # - a Path object
21
23
  # - a tuple with a path, and a list of file
22
24
  one = os.path.join(pkg_dir, 'one')
23
25
  self.write_file(one, 'xxx')
24
26
  inst2 = os.path.join(pkg_dir, 'inst2')
25
27
  two = os.path.join(pkg_dir, 'two')
26
28
  self.write_file(two, 'xxx')
29
+ three = pathlib.Path(pkg_dir) / 'three'
30
+ self.write_file(three, 'xxx')
27
31
 
28
- cmd.data_files = [one, (inst2, [two])]
29
- assert cmd.get_inputs() == [one, (inst2, [two])]
32
+ cmd.data_files = [one, (inst2, [two]), three]
33
+ assert cmd.get_inputs() == [one, (inst2, [two]), three]
30
34
 
31
35
  # let's run the command
32
36
  cmd.ensure_finalized()
33
37
  cmd.run()
34
38
 
35
39
  # let's check the result
36
- assert len(cmd.get_outputs()) == 2
40
+ assert len(cmd.get_outputs()) == 3
41
+ rthree = os.path.split(one)[-1]
42
+ assert os.path.exists(os.path.join(inst, rthree))
37
43
  rtwo = os.path.split(two)[-1]
38
44
  assert os.path.exists(os.path.join(inst2, rtwo))
39
45
  rone = os.path.split(one)[-1]
@@ -46,21 +52,23 @@ class TestInstallData(
46
52
  cmd.run()
47
53
 
48
54
  # let's check the result
49
- assert len(cmd.get_outputs()) == 2
55
+ assert len(cmd.get_outputs()) == 3
56
+ assert os.path.exists(os.path.join(inst, rthree))
50
57
  assert os.path.exists(os.path.join(inst2, rtwo))
51
58
  assert os.path.exists(os.path.join(inst, rone))
52
59
  cmd.outfiles = []
53
60
 
54
61
  # now using root and empty dir
55
62
  cmd.root = os.path.join(pkg_dir, 'root')
56
- inst4 = os.path.join(pkg_dir, 'inst4')
57
- three = os.path.join(cmd.install_dir, 'three')
58
- self.write_file(three, 'xx')
59
- cmd.data_files = [one, (inst2, [two]), ('inst3', [three]), (inst4, [])]
63
+ inst5 = os.path.join(pkg_dir, 'inst5')
64
+ four = os.path.join(cmd.install_dir, 'four')
65
+ self.write_file(four, 'xx')
66
+ cmd.data_files = [one, (inst2, [two]), three, ('inst5', [four]), (inst5, [])]
60
67
  cmd.ensure_finalized()
61
68
  cmd.run()
62
69
 
63
70
  # let's check the result
64
- assert len(cmd.get_outputs()) == 4
71
+ assert len(cmd.get_outputs()) == 5
72
+ assert os.path.exists(os.path.join(inst, rthree))
65
73
  assert os.path.exists(os.path.join(inst2, rtwo))
66
74
  assert os.path.exists(os.path.join(inst, rone))
@@ -1,8 +1,8 @@
1
- import pytest
2
-
3
- from distutils.util import split_quoted, is_mingw
4
- from distutils.errors import DistutilsPlatformError, CCompilerError
5
1
  from distutils import sysconfig
2
+ from distutils.errors import CCompilerError, DistutilsPlatformError
3
+ from distutils.util import is_mingw, split_quoted
4
+
5
+ import pytest
6
6
 
7
7
 
8
8
  class TestMingw32CCompiler:
@@ -45,6 +45,7 @@ class TestMingw32CCompiler:
45
45
  with pytest.raises(CCompilerError):
46
46
  distutils.cygwinccompiler.Mingw32CCompiler()
47
47
 
48
+ @pytest.mark.skipif('sys.platform == "cygwin"')
48
49
  def test_customize_compiler_with_msvc_python(self):
49
50
  from distutils.cygwinccompiler import Mingw32CCompiler
50
51
 
@@ -7,10 +7,10 @@ import unittest.mock as mock
7
7
  from distutils.errors import DistutilsExecError
8
8
  from distutils.spawn import find_executable, spawn
9
9
  from distutils.tests import support
10
- from test.support import unix_shell
11
10
 
12
11
  import path
13
12
  import pytest
13
+ from test.support import unix_shell
14
14
 
15
15
  from .compat import py38 as os_helper
16
16
 
@@ -9,12 +9,12 @@ import sys
9
9
  from distutils import sysconfig
10
10
  from distutils.ccompiler import new_compiler # noqa: F401
11
11
  from distutils.unixccompiler import UnixCCompiler
12
- from test.support import swap_item
13
12
 
14
13
  import jaraco.envs
15
14
  import path
16
15
  import pytest
17
16
  from jaraco.text import trim
17
+ from test.support import swap_item
18
18
 
19
19
 
20
20
  def _gen_makefile(root, contents):
@@ -134,7 +134,10 @@ class TestSysconfig:
134
134
  assert comp.exes['compiler_so'] == (
135
135
  'env_cc --sc-cflags --env-cflags --env-cppflags --sc-ccshared'
136
136
  )
137
- assert comp.exes['compiler_cxx'] == 'env_cxx --env-cxx-flags'
137
+ assert (
138
+ comp.exes['compiler_cxx']
139
+ == 'env_cxx --env-cxx-flags --sc-cflags --env-cppflags'
140
+ )
138
141
  assert comp.exes['linker_exe'] == 'env_cc'
139
142
  assert comp.exes['linker_so'] == (
140
143
  'env_ldshared --env-ldflags --env-cflags --env-cppflags'
@@ -162,7 +165,7 @@ class TestSysconfig:
162
165
  assert comp.exes['preprocessor'] == 'sc_cc -E'
163
166
  assert comp.exes['compiler'] == 'sc_cc --sc-cflags'
164
167
  assert comp.exes['compiler_so'] == 'sc_cc --sc-cflags --sc-ccshared'
165
- assert comp.exes['compiler_cxx'] == 'sc_cxx'
168
+ assert comp.exes['compiler_cxx'] == 'sc_cxx --sc-cflags'
166
169
  assert comp.exes['linker_exe'] == 'sc_cc'
167
170
  assert comp.exes['linker_so'] == 'sc_ldshared'
168
171
  assert comp.shared_lib_extension == 'sc_shutil_suffix'
@@ -257,9 +257,13 @@ class TestUnixCCompiler(support.TempdirManager):
257
257
  def gcv(v):
258
258
  if v == 'LDSHARED':
259
259
  return 'gcc-4.2 -bundle -undefined dynamic_lookup '
260
+ elif v == 'LDCXXSHARED':
261
+ return 'g++-4.2 -bundle -undefined dynamic_lookup '
260
262
  elif v == 'CXX':
261
263
  return 'g++-4.2'
262
- return 'gcc-4.2'
264
+ elif v == 'CC':
265
+ return 'gcc-4.2'
266
+ return ''
263
267
 
264
268
  def gcvs(*args, _orig=sysconfig.get_config_vars):
265
269
  if args:
@@ -315,3 +319,33 @@ class TestUnixCCompiler(support.TempdirManager):
315
319
  self.cc.output_dir = 'scratch'
316
320
  os.chdir(self.mkdtemp())
317
321
  self.cc.has_function('abort')
322
+
323
+ def test_find_library_file(self, monkeypatch):
324
+ compiler = UnixCCompiler()
325
+ compiler._library_root = lambda dir: dir
326
+ monkeypatch.setattr(os.path, 'exists', lambda d: 'existing' in d)
327
+
328
+ libname = 'libabc.dylib' if sys.platform != 'cygwin' else 'cygabc.dll'
329
+ dirs = ('/foo/bar/missing', '/foo/bar/existing')
330
+ assert (
331
+ compiler.find_library_file(dirs, 'abc').replace('\\', '/')
332
+ == f'/foo/bar/existing/{libname}'
333
+ )
334
+ assert (
335
+ compiler.find_library_file(reversed(dirs), 'abc').replace('\\', '/')
336
+ == f'/foo/bar/existing/{libname}'
337
+ )
338
+
339
+ monkeypatch.setattr(
340
+ os.path,
341
+ 'exists',
342
+ lambda d: 'existing' in d and '.a' in d and '.dll.a' not in d,
343
+ )
344
+ assert (
345
+ compiler.find_library_file(dirs, 'abc').replace('\\', '/')
346
+ == '/foo/bar/existing/libabc.a'
347
+ )
348
+ assert (
349
+ compiler.find_library_file(reversed(dirs), 'abc').replace('\\', '/')
350
+ == '/foo/bar/existing/libabc.a'
351
+ )
@@ -5,6 +5,7 @@ import email.generator
5
5
  import email.policy
6
6
  import io
7
7
  import os
8
+ import pathlib
8
9
  import sys
9
10
  import sysconfig as stdlib_sysconfig
10
11
  import unittest.mock as mock
@@ -63,30 +64,9 @@ class TestUtil:
63
64
  assert get_platform() == 'win-arm64'
64
65
 
65
66
  def test_convert_path(self):
66
- # linux/mac
67
- os.sep = '/'
68
-
69
- def _join(path):
70
- return '/'.join(path)
71
-
72
- os.path.join = _join
73
-
74
- assert convert_path('/home/to/my/stuff') == '/home/to/my/stuff'
75
-
76
- # win
77
- os.sep = '\\'
78
-
79
- def _join(*path):
80
- return '\\'.join(path)
81
-
82
- os.path.join = _join
83
-
84
- with pytest.raises(ValueError):
85
- convert_path('/home/to/my/stuff')
86
- with pytest.raises(ValueError):
87
- convert_path('home/to/my/stuff/')
88
-
89
- assert convert_path('home/to/my/stuff') == 'home\\to\\my\\stuff'
67
+ expected = os.sep.join(('', 'home', 'to', 'my', 'stuff'))
68
+ assert convert_path('/home/to/my/stuff') == expected
69
+ assert convert_path(pathlib.Path('/home/to/my/stuff')) == expected
90
70
  assert convert_path('.') == os.curdir
91
71
 
92
72
  def test_change_root(self):
@@ -118,9 +118,12 @@ class UnixCCompiler(CCompiler):
118
118
  'preprocessor': None,
119
119
  'compiler': ["cc"],
120
120
  'compiler_so': ["cc"],
121
- 'compiler_cxx': ["cc"],
121
+ 'compiler_cxx': ["c++"],
122
+ 'compiler_so_cxx': ["c++"],
122
123
  'linker_so': ["cc", "-shared"],
124
+ 'linker_so_cxx': ["c++", "-shared"],
123
125
  'linker_exe': ["cc"],
126
+ 'linker_exe_cxx': ["c++", "-shared"],
124
127
  'archiver': ["ar", "-cr"],
125
128
  'ranlib': None,
126
129
  }
@@ -187,8 +190,14 @@ class UnixCCompiler(CCompiler):
187
190
 
188
191
  def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
189
192
  compiler_so = compiler_fixup(self.compiler_so, cc_args + extra_postargs)
193
+ compiler_so_cxx = compiler_fixup(self.compiler_so_cxx, cc_args + extra_postargs)
190
194
  try:
191
- self.spawn(compiler_so + cc_args + [src, '-o', obj] + extra_postargs)
195
+ if self.detect_language(src) == 'c++':
196
+ self.spawn(
197
+ compiler_so_cxx + cc_args + [src, '-o', obj] + extra_postargs
198
+ )
199
+ else:
200
+ self.spawn(compiler_so + cc_args + [src, '-o', obj] + extra_postargs)
192
201
  except DistutilsExecError as msg:
193
202
  raise CompileError(msg)
194
203
 
@@ -256,7 +265,13 @@ class UnixCCompiler(CCompiler):
256
265
  # building an executable or linker_so (with shared options)
257
266
  # when building a shared library.
258
267
  building_exe = target_desc == CCompiler.EXECUTABLE
259
- linker = (self.linker_exe if building_exe else self.linker_so)[:]
268
+ linker = (
269
+ self.linker_exe
270
+ if building_exe
271
+ else (
272
+ self.linker_so_cxx if target_lang == "c++" else self.linker_so
273
+ )
274
+ )[:]
260
275
 
261
276
  if target_lang == "c++" and self.compiler_cxx:
262
277
  env, linker_ne = _split_env(linker)
@@ -366,27 +381,11 @@ class UnixCCompiler(CCompiler):
366
381
  return os.path.join(match.group(1), dir[1:]) if apply_root else dir
367
382
 
368
383
  def find_library_file(self, dirs, lib, debug=False):
369
- r"""
384
+ """
370
385
  Second-guess the linker with not much hard
371
386
  data to go on: GCC seems to prefer the shared library, so
372
387
  assume that *all* Unix C compilers do,
373
388
  ignoring even GCC's "-static" option.
374
-
375
- >>> compiler = UnixCCompiler()
376
- >>> compiler._library_root = lambda dir: dir
377
- >>> monkeypatch = getfixture('monkeypatch')
378
- >>> monkeypatch.setattr(os.path, 'exists', lambda d: 'existing' in d)
379
- >>> dirs = ('/foo/bar/missing', '/foo/bar/existing')
380
- >>> compiler.find_library_file(dirs, 'abc').replace('\\', '/')
381
- '/foo/bar/existing/libabc.dylib'
382
- >>> compiler.find_library_file(reversed(dirs), 'abc').replace('\\', '/')
383
- '/foo/bar/existing/libabc.dylib'
384
- >>> monkeypatch.setattr(os.path, 'exists',
385
- ... lambda d: 'existing' in d and '.a' in d)
386
- >>> compiler.find_library_file(dirs, 'abc').replace('\\', '/')
387
- '/foo/bar/existing/libabc.a'
388
- >>> compiler.find_library_file(reversed(dirs), 'abc').replace('\\', '/')
389
- '/foo/bar/existing/libabc.a'
390
389
  """
391
390
  lib_names = (
392
391
  self.library_filename(lib, lib_type=type)
@@ -4,9 +4,12 @@ Miscellaneous utility functions -- anything that doesn't fit into
4
4
  one of the other *util.py modules.
5
5
  """
6
6
 
7
+ from __future__ import annotations
8
+
7
9
  import functools
8
10
  import importlib.util
9
11
  import os
12
+ import pathlib
10
13
  import re
11
14
  import string
12
15
  import subprocess
@@ -14,6 +17,7 @@ import sys
14
17
  import sysconfig
15
18
  import tempfile
16
19
 
20
+ from ._functools import pass_none
17
21
  from ._log import log
18
22
  from ._modified import newer
19
23
  from .errors import DistutilsByteCompileError, DistutilsPlatformError
@@ -116,33 +120,23 @@ def split_version(s):
116
120
  return [int(n) for n in s.split('.')]
117
121
 
118
122
 
119
- def convert_path(pathname):
120
- """Return 'pathname' as a name that will work on the native filesystem,
121
- i.e. split it on '/' and put it back together again using the current
122
- directory separator. Needed because filenames in the setup script are
123
- always supplied in Unix style, and have to be converted to the local
124
- convention before we can actually use them in the filesystem. Raises
125
- ValueError on non-Unix-ish systems if 'pathname' either starts or
126
- ends with a slash.
123
+ @pass_none
124
+ def convert_path(pathname: str | os.PathLike) -> str:
125
+ r"""
126
+ Allow for pathlib.Path inputs, coax to a native path string.
127
+
128
+ If None is passed, will just pass it through as
129
+ Setuptools relies on this behavior.
130
+
131
+ >>> convert_path(None) is None
132
+ True
133
+
134
+ Removes empty paths.
135
+
136
+ >>> convert_path('foo/./bar').replace('\\', '/')
137
+ 'foo/bar'
127
138
  """
128
- if os.sep == '/':
129
- return pathname
130
- if not pathname:
131
- return pathname
132
- if pathname[0] == '/':
133
- raise ValueError(f"path '{pathname}' cannot be absolute")
134
- if pathname[-1] == '/':
135
- raise ValueError(f"path '{pathname}' cannot end with '/'")
136
-
137
- paths = pathname.split('/')
138
- while '.' in paths:
139
- paths.remove('.')
140
- if not paths:
141
- return os.curdir
142
- return os.path.join(*paths)
143
-
144
-
145
- # convert_path ()
139
+ return os.fspath(pathlib.PurePath(pathname))
146
140
 
147
141
 
148
142
  def change_root(new_root, pathname):
@@ -0,0 +1,3 @@
1
+ from __future__ import annotations
2
+
3
+ __version__ = "0.44.0"
@@ -0,0 +1,23 @@
1
+ """
2
+ Wheel command line tool (enable python -m wheel syntax)
3
+ """
4
+
5
+ from __future__ import annotations
6
+
7
+ import sys
8
+
9
+
10
+ def main(): # needed for console script
11
+ if __package__ == "":
12
+ # To be able to run 'python wheel-0.9.whl/wheel':
13
+ import os.path
14
+
15
+ path = os.path.dirname(os.path.dirname(__file__))
16
+ sys.path[0:0] = [path]
17
+ import wheel.cli
18
+
19
+ sys.exit(wheel.cli.main())
20
+
21
+
22
+ if __name__ == "__main__":
23
+ sys.exit(main())