annotate files/patch-lib-python_2.7_sysconfig.py @ 44:ff83a2d91909

FIX: Do not try to write sysconfigdata into the currend working directory: use WRKDIR instead
author Franz Glasner <fzglas.hg@dom66.de>
date Sun, 09 Oct 2022 16:00:56 +0200
parents cb562cb4ec47
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18
cb562cb4ec47 Do not write a file into the current working directory when building: use WRKDIR instead
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
1 --- lib-python/2.7/sysconfig.py.orig 2022-03-28 09:50:42 UTC
cb562cb4ec47 Do not write a file into the current working directory when building: use WRKDIR instead
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
2 +++ lib-python/2.7/sysconfig.py
44
ff83a2d91909 FIX: Do not try to write sysconfigdata into the currend working directory: use WRKDIR instead
Franz Glasner <fzglas.hg@dom66.de>
parents: 18
diff changeset
3 @@ -366,13 +366,15 @@ def _generate_posix_vars():
ff83a2d91909 FIX: Do not try to write sysconfigdata into the currend working directory: use WRKDIR instead
Franz Glasner <fzglas.hg@dom66.de>
parents: 18
diff changeset
4 module.build_time_vars = vars
ff83a2d91909 FIX: Do not try to write sysconfigdata into the currend working directory: use WRKDIR instead
Franz Glasner <fzglas.hg@dom66.de>
parents: 18
diff changeset
5 sys.modules[name] = module
ff83a2d91909 FIX: Do not try to write sysconfigdata into the currend working directory: use WRKDIR instead
Franz Glasner <fzglas.hg@dom66.de>
parents: 18
diff changeset
6
ff83a2d91909 FIX: Do not try to write sysconfigdata into the currend working directory: use WRKDIR instead
Franz Glasner <fzglas.hg@dom66.de>
parents: 18
diff changeset
7 + pypy_wrkdir = os.environ.get("PYPY_WRKDIR") # this is set by FreeBSD port
ff83a2d91909 FIX: Do not try to write sysconfigdata into the currend working directory: use WRKDIR instead
Franz Glasner <fzglas.hg@dom66.de>
parents: 18
diff changeset
8 +
ff83a2d91909 FIX: Do not try to write sysconfigdata into the currend working directory: use WRKDIR instead
Franz Glasner <fzglas.hg@dom66.de>
parents: 18
diff changeset
9 pybuilddir = 'build/lib.%s-%s' % (get_platform(), sys.version[:3])
ff83a2d91909 FIX: Do not try to write sysconfigdata into the currend working directory: use WRKDIR instead
Franz Glasner <fzglas.hg@dom66.de>
parents: 18
diff changeset
10 + if pypy_wrkdir is not None:
ff83a2d91909 FIX: Do not try to write sysconfigdata into the currend working directory: use WRKDIR instead
Franz Glasner <fzglas.hg@dom66.de>
parents: 18
diff changeset
11 + pybuilddir = os.path.join(pypy_wrkdir, pybuilddir)
ff83a2d91909 FIX: Do not try to write sysconfigdata into the currend working directory: use WRKDIR instead
Franz Glasner <fzglas.hg@dom66.de>
parents: 18
diff changeset
12 if hasattr(sys, "gettotalrefcount"):
ff83a2d91909 FIX: Do not try to write sysconfigdata into the currend working directory: use WRKDIR instead
Franz Glasner <fzglas.hg@dom66.de>
parents: 18
diff changeset
13 pybuilddir += '-pydebug'
ff83a2d91909 FIX: Do not try to write sysconfigdata into the currend working directory: use WRKDIR instead
Franz Glasner <fzglas.hg@dom66.de>
parents: 18
diff changeset
14 - try:
ff83a2d91909 FIX: Do not try to write sysconfigdata into the currend working directory: use WRKDIR instead
Franz Glasner <fzglas.hg@dom66.de>
parents: 18
diff changeset
15 + if not os.path.isdir(pybuilddir):
ff83a2d91909 FIX: Do not try to write sysconfigdata into the currend working directory: use WRKDIR instead
Franz Glasner <fzglas.hg@dom66.de>
parents: 18
diff changeset
16 os.makedirs(pybuilddir)
ff83a2d91909 FIX: Do not try to write sysconfigdata into the currend working directory: use WRKDIR instead
Franz Glasner <fzglas.hg@dom66.de>
parents: 18
diff changeset
17 - except OSError:
ff83a2d91909 FIX: Do not try to write sysconfigdata into the currend working directory: use WRKDIR instead
Franz Glasner <fzglas.hg@dom66.de>
parents: 18
diff changeset
18 - pass
ff83a2d91909 FIX: Do not try to write sysconfigdata into the currend working directory: use WRKDIR instead
Franz Glasner <fzglas.hg@dom66.de>
parents: 18
diff changeset
19 destfile = os.path.join(pybuilddir, name + '.py')
ff83a2d91909 FIX: Do not try to write sysconfigdata into the currend working directory: use WRKDIR instead
Franz Glasner <fzglas.hg@dom66.de>
parents: 18
diff changeset
20
ff83a2d91909 FIX: Do not try to write sysconfigdata into the currend working directory: use WRKDIR instead
Franz Glasner <fzglas.hg@dom66.de>
parents: 18
diff changeset
21 with open(destfile, 'wb') as f:
ff83a2d91909 FIX: Do not try to write sysconfigdata into the currend working directory: use WRKDIR instead
Franz Glasner <fzglas.hg@dom66.de>
parents: 18
diff changeset
22 @@ -382,7 +384,10 @@ def _generate_posix_vars():
18
cb562cb4ec47 Do not write a file into the current working directory when building: use WRKDIR instead
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
23 pprint.pprint(vars, stream=f)
cb562cb4ec47 Do not write a file into the current working directory when building: use WRKDIR instead
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
24
cb562cb4ec47 Do not write a file into the current working directory when building: use WRKDIR instead
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
25 # Create file used for sys.path fixup -- see Modules/getpath.c
cb562cb4ec47 Do not write a file into the current working directory when building: use WRKDIR instead
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
26 - with open('pybuilddir.txt', 'w') as f:
cb562cb4ec47 Do not write a file into the current working directory when building: use WRKDIR instead
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
27 + pybuilddir_txt = 'pybuilddir.txt'
cb562cb4ec47 Do not write a file into the current working directory when building: use WRKDIR instead
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
28 + if pypy_wrkdir is not None:
cb562cb4ec47 Do not write a file into the current working directory when building: use WRKDIR instead
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
29 + pybuilddir_txt = os.path.join(pypy_wrkdir, pybuilddir_txt)
cb562cb4ec47 Do not write a file into the current working directory when building: use WRKDIR instead
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
30 + with open(pybuilddir_txt, 'w') as f:
cb562cb4ec47 Do not write a file into the current working directory when building: use WRKDIR instead
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
31 f.write(pybuilddir)
cb562cb4ec47 Do not write a file into the current working directory when building: use WRKDIR instead
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
32
cb562cb4ec47 Do not write a file into the current working directory when building: use WRKDIR instead
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
33 def _init_posix(vars):