| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent a155f9f commit a4baa9e
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,3 @@ | |||
| 1 | + Fix test_tools.test_freeze on FreeBSD: run "make distclean" instead of "make | ||
| 2 | + clean" in the copied source directory to remove also the "python" program. | ||
| 3 | + Patch by Victor Stinner. | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -27,8 +27,10 @@ class UnsupportedError(Exception): | |||
| 27 | 27 | """The operation isn't supported.""" | |
| 28 | 28 | ||
| 29 | 29 | ||
| 30 | - def _run_quiet(cmd, cwd=None): | ||
| 31 | - #print(f'# {" ".join(shlex.quote(a) for a in cmd)}') | ||
| 30 | + def _run_quiet(cmd, *, cwd=None): | ||
| 31 | + if cwd: | ||
| 32 | + print('+', 'cd', cwd, flush=True) | ||
| 33 | + print('+', shlex.join(cmd), flush=True) | ||
| 32 | 34 | try: | |
| 33 | 35 | return subprocess.run( | |
| 34 | 36 | cmd, | |
@@ -48,8 +50,8 @@ def _run_quiet(cmd, cwd=None): | |||
| 48 | 50 | raise | |
| 49 | 51 | ||
| 50 | 52 | ||
| 51 | - def _run_stdout(cmd, cwd=None): | ||
| 52 | - proc = _run_quiet(cmd, cwd) | ||
| 53 | + def _run_stdout(cmd): | ||
| 54 | + proc = _run_quiet(cmd) | ||
| 53 | 55 | return proc.stdout.strip() | |
| 54 | 56 | ||
| 55 | 57 | ||
@@ -91,13 +93,18 @@ def copy_source_tree(newroot, oldroot): | |||
| 91 | 93 | ||
| 92 | 94 | shutil.copytree(oldroot, newroot, ignore=support.copy_python_src_ignore) | |
| 93 | 95 | if os.path.exists(os.path.join(newroot, 'Makefile')): | |
| 94 | - _run_quiet([MAKE, 'clean'], newroot) | ||
| 96 | + # Out-of-tree builds require a clean srcdir. "make clean" keeps | ||
| 97 | + # the "python" program, so use "make distclean" instead. | ||
| 98 | + _run_quiet([MAKE, 'distclean'], cwd=newroot) | ||
| 95 | 99 | ||
| 96 | 100 | ||
| 97 | 101 | ################################## | |
| 98 | 102 | # freezing | |
| 99 | 103 | ||
| 100 | 104 | def prepare(script=None, outdir=None): | |
| 105 | + print() | ||
| 106 | + print("cwd:", os.getcwd()) | ||
| 107 | + | ||
| 101 | 108 | if not outdir: | |
| 102 | 109 | outdir = OUTDIR | |
| 103 | 110 | os.makedirs(outdir, exist_ok=True) | |
@@ -125,7 +132,7 @@ def prepare(script=None, outdir=None): | |||
| 125 | 132 | ensure_opt(cmd, 'cache-file', os.path.join(outdir, 'python-config.cache')) | |
| 126 | 133 | prefix = os.path.join(outdir, 'python-installation') | |
| 127 | 134 | ensure_opt(cmd, 'prefix', prefix) | |
| 128 | - _run_quiet(cmd, builddir) | ||
| 135 | + _run_quiet(cmd, cwd=builddir) | ||
| 129 | 136 | ||
| 130 | 137 | if not MAKE: | |
| 131 | 138 | raise UnsupportedError('make') | |
@@ -135,20 +142,18 @@ def prepare(script=None, outdir=None): | |||
| 135 | 142 | # this test is most often run as part of the whole suite with a lot | |
| 136 | 143 | # of other tests running in parallel, from 1-2 vCPU systems up to | |
| 137 | 144 | # people's NNN core beasts. Don't attempt to use it all. | |
| 138 | - parallel = f'-j{cores*2//3}' | ||
| 145 | + jobs = cores * 2 // 3 | ||
| 146 | + parallel = f'-j{jobs}' | ||
| 139 | 147 | else: | |
| 140 | 148 | parallel = '-j2' | |
| 141 | 149 | ||
| 142 | 150 | # Build python. | |
| 143 | 151 | print(f'building python {parallel=} in {builddir}...') | |
| 144 | - if os.path.exists(os.path.join(srcdir, 'Makefile')): | ||
| 145 | - # Out-of-tree builds require a clean srcdir. | ||
| 146 | - _run_quiet([MAKE, '-C', srcdir, 'clean']) | ||
| 147 | - _run_quiet([MAKE, '-C', builddir, parallel]) | ||
| 152 | + _run_quiet([MAKE, parallel], cwd=builddir) | ||
| 148 | 153 | ||
| 149 | 154 | # Install the build. | |
| 150 | 155 | print(f'installing python into {prefix}...') | |
| 151 | - _run_quiet([MAKE, '-C', builddir, 'install']) | ||
| 156 | + _run_quiet([MAKE, 'install'], cwd=builddir) | ||
| 152 | 157 | python = os.path.join(prefix, 'bin', 'python3') | |
| 153 | 158 | ||
| 154 | 159 | return outdir, scriptfile, python | |
@@ -161,8 +166,8 @@ def freeze(python, scriptfile, outdir): | |||
| 161 | 166 | print(f'freezing {scriptfile}...') | |
| 162 | 167 | os.makedirs(outdir, exist_ok=True) | |
| 163 | 168 | # Use -E to ignore PYTHONSAFEPATH | |
| 164 | - _run_quiet([python, '-E', FREEZE, '-o', outdir, scriptfile], outdir) | ||
| 165 | - _run_quiet([MAKE, '-C', os.path.dirname(scriptfile)]) | ||
| 169 | + _run_quiet([python, '-E', FREEZE, '-o', outdir, scriptfile], cwd=outdir) | ||
| 170 | + _run_quiet([MAKE], cwd=os.path.dirname(scriptfile)) | ||
| 166 | 171 | ||
| 167 | 172 | name = os.path.basename(scriptfile).rpartition('.')[0] | |
| 168 | 173 | executable = os.path.join(outdir, name) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments