8000 gh-91985: Ensure in-tree builds override platstdlib_dir in every path calculation by neonene · Pull Request #93641 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-91985: Ensure in-tree builds override platstdlib_dir in every path calculation #93641

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Jun 16, 2022
Merged
Prev Previous commit
Next Next commit
reword
  • Loading branch information
neonene committed Jun 13, 2022
commit bc861bfe83b047f91b37afa4fe98ad3c34c97dd3
16 changes: 8 additions & 8 deletions Lib/test/test_getpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def test_buildtree_pythonhome_win32(self):
self.assertEqual(expected, actual)

def test_run_in_tree_build_win32(self):
"Test _is_python_build fields with edge cases.(gh-91985)"
"Test _is_python_build fields with invalid cases.(gh-91985)"
def read_pathconfig(config, attr):
if _Py_path_config[attr] >= 0 and config[attr] <= 0:
config[attr] = _Py_path_config[attr]
Expand All @@ -249,37 +249,37 @@ def update_pathconfig(config, attr):
if config[attr] > 0:
_Py_path_config[attr] = config[attr]

for edges in [(0,-1), (-1, 0), (-1,-1), (-10, 0), [-10, 5], [5,-10]]:
for flags in [(0,-1), (-1, 0), (-1,-1), (-10, 0), [-10, 5], [5,-10]]:
_Py_path_config = dict(
_is_python_build=edges[0],
_is_python_build=flags[0],
)
ns = MockNTNamespace(
argv0=r"C:\CPython\PCbuild\amd64\python.exe",
)
ns.add_known_file(r"C:\CPython\PCbuild\amd64\pybuilddir.txt", [""])
ns['config'].update(
home=r"C:\CPython", # turn on 'home_was_set'
_is_python_build=edges[1],
_is_python_build=flags[1],
)
# _PyConfig_InitPathConfig emulation
read_pathconfig(ns['config'], '_is_python_build')
if isinstance(edges, tuple):
if isinstance(flags, tuple):
expected = dict(
_is_python_build=ns['config']['_is_python_build'],
build_prefix=None,
platstdlib_dir=r"C:\CPython\DLLs",
)
else:
edges = (1, 1)
flags = (1, 1)
expected = dict(
_is_python_build=edges[1],
_is_python_build=flags[1],
build_prefix=r"C:\CPython",
platstdlib_dir=r"C:\CPython\PCbuild\amd64",
)
actual = getpath(ns, expected)
self.assertEqual(actual, expected)
update_pathconfig(actual, '_is_python_build')
self.assertEqual(_Py_path_config['_is_python_build'], edges[0])
self.assertEqual(_Py_path_config['_is_python_build'], flags[0])

def test_normal_posix(self):
"Test a 'standard' install layout on *nix"
Expand Down
0