portable-python 1.8.1__tar.gz → 1.8.3__tar.gz

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 (38) hide show
  1. {portable-python-1.8.1/src/portable_python.egg-info → portable-python-1.8.3}/PKG-INFO +1 -1
  2. {portable-python-1.8.1 → portable-python-1.8.3}/src/portable_python/__init__.py +6 -1
  3. {portable-python-1.8.1 → portable-python-1.8.3}/src/portable_python/config.py +2 -2
  4. {portable-python-1.8.1 → portable-python-1.8.3}/src/portable_python/cpython.py +23 -5
  5. {portable-python-1.8.1 → portable-python-1.8.3/src/portable_python.egg-info}/PKG-INFO +1 -1
  6. {portable-python-1.8.1 → portable-python-1.8.3}/tests/test_build.py +3 -2
  7. {portable-python-1.8.1 → portable-python-1.8.3}/tests/test_failed.py +7 -0
  8. {portable-python-1.8.1 → portable-python-1.8.3}/DEVELOP.md +0 -0
  9. {portable-python-1.8.1 → portable-python-1.8.3}/LICENSE +0 -0
  10. {portable-python-1.8.1 → portable-python-1.8.3}/MANIFEST.in +0 -0
  11. {portable-python-1.8.1 → portable-python-1.8.3}/README.rst +0 -0
  12. {portable-python-1.8.1 → portable-python-1.8.3}/SECURITY.md +0 -0
  13. {portable-python-1.8.1 → portable-python-1.8.3}/pyproject.toml +0 -0
  14. {portable-python-1.8.1 → portable-python-1.8.3}/requirements.txt +0 -0
  15. {portable-python-1.8.1 → portable-python-1.8.3}/setup.cfg +0 -0
  16. {portable-python-1.8.1 → portable-python-1.8.3}/setup.py +0 -0
  17. {portable-python-1.8.1 → portable-python-1.8.3}/src/portable_python/__main__.py +0 -0
  18. {portable-python-1.8.1 → portable-python-1.8.3}/src/portable_python/cli.py +0 -0
  19. {portable-python-1.8.1 → portable-python-1.8.3}/src/portable_python/external/__init__.py +0 -0
  20. {portable-python-1.8.1 → portable-python-1.8.3}/src/portable_python/external/_inspect.py +0 -0
  21. {portable-python-1.8.1 → portable-python-1.8.3}/src/portable_python/external/tkinter.py +0 -0
  22. {portable-python-1.8.1 → portable-python-1.8.3}/src/portable_python/external/xcpython.py +0 -0
  23. {portable-python-1.8.1 → portable-python-1.8.3}/src/portable_python/inspector.py +0 -0
  24. {portable-python-1.8.1 → portable-python-1.8.3}/src/portable_python/tracking.py +0 -0
  25. {portable-python-1.8.1 → portable-python-1.8.3}/src/portable_python/versions.py +0 -0
  26. {portable-python-1.8.1 → portable-python-1.8.3}/src/portable_python.egg-info/SOURCES.txt +0 -0
  27. {portable-python-1.8.1 → portable-python-1.8.3}/src/portable_python.egg-info/dependency_links.txt +0 -0
  28. {portable-python-1.8.1 → portable-python-1.8.3}/src/portable_python.egg-info/entry_points.txt +0 -0
  29. {portable-python-1.8.1 → portable-python-1.8.3}/src/portable_python.egg-info/requires.txt +0 -0
  30. {portable-python-1.8.1 → portable-python-1.8.3}/src/portable_python.egg-info/top_level.txt +0 -0
  31. {portable-python-1.8.1 → portable-python-1.8.3}/tests/test_cleanup.py +0 -0
  32. {portable-python-1.8.1 → portable-python-1.8.3}/tests/test_inspector.py +0 -0
  33. {portable-python-1.8.1 → portable-python-1.8.3}/tests/test_invoker.py +0 -0
  34. {portable-python-1.8.1 → portable-python-1.8.3}/tests/test_list.py +0 -0
  35. {portable-python-1.8.1 → portable-python-1.8.3}/tests/test_prefix.py +0 -0
  36. {portable-python-1.8.1 → portable-python-1.8.3}/tests/test_recompress.py +0 -0
  37. {portable-python-1.8.1 → portable-python-1.8.3}/tests/test_report.py +0 -0
  38. {portable-python-1.8.1 → portable-python-1.8.3}/tests/test_setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: portable-python
3
- Version: 1.8.1
3
+ Version: 1.8.3
4
4
  Summary: Portable python binaries
5
5
  Home-page: https://github.com/codrsquad/portable-python
6
6
  Author: Zoran Simic
@@ -520,7 +520,8 @@ class ModuleBuilder:
520
520
  yield f"{self.deps_lib}/pkgconfig"
521
521
 
522
522
  def _do_run(self, program, *args, fatal=True, env=None):
523
- return runez.run(program, *args, passthrough=self._log_handler, stdout=None, stderr=None, fatal=fatal, env=env)
523
+ logger = self._log_handler
524
+ return runez.run(program, *args, passthrough=logger, stdout=None, stderr=None, fatal=fatal, env=env, logger=logger or runez.UNSET)
524
525
 
525
526
  def run_configure(self, program, *args, prefix=None):
526
527
  """
@@ -562,6 +563,10 @@ class ModuleBuilder:
562
563
 
563
564
  yield
564
565
 
566
+ except Exception as e:
567
+ LOG.error("Error while compiling %r: %r", self, e)
568
+ raise
569
+
565
570
  finally:
566
571
  if self._log_handler:
567
572
  logging.root.removeHandler(self._log_handler)
@@ -29,14 +29,13 @@ ext: gz
29
29
 
30
30
  # Pre -mcompileall, cleanup tests and useless files (~94 MB)
31
31
  cpython-clean-1st-pass:
32
- - __phello__.foo.py
33
32
  - __pycache__/
34
33
  - _test*capi.*
35
34
  - idle_test/
36
35
  - test/
37
36
  - tests/
38
37
  # By default, simplify bin/ folder
39
- - bin/2to3* bin/easy_install* bin/idle3* bin/pydoc* bin/pyvenv* bin/wheel*
38
+ - bin/2to3* bin/easy_install* bin/idle3*
40
39
 
41
40
  # wininst-* is probably an old goof (~2 MB of .exe binaries)
42
41
  cpython-clean-1st-pass-linux: wininst-*
@@ -231,6 +230,7 @@ class Config:
231
230
  _find_file_duplicates(seen, folder)
232
231
  duplicates = {k: v for k, v in seen.items() if len(v) > 1}
233
232
  for dupes in duplicates.values():
233
+ LOG.info("Found duplicates: %s" % runez.joined(dupes, delimiter=", "))
234
234
  dupes = sorted(dupes, key=lambda x: len(str(x)))
235
235
  if len(dupes) == 2:
236
236
  shorter, longer = dupes
@@ -162,10 +162,6 @@ class Cpython(PythonBuilder):
162
162
 
163
163
  PPG.config.cleanup_folder(self, "cpython-clean-1st-pass")
164
164
  PPG.config.symlink_duplicates(self.install_folder)
165
- py_inspector = PythonInspector(self.install_folder)
166
- print(py_inspector.represented())
167
- problem = py_inspector.full_so_report.get_problem(portable=not is_shared)
168
- runez.abort_if(problem and self.setup.x_debug != "direct-finalize", "Build failed: %s" % problem)
169
165
  validation_script = PPG.config.resolved_path("cpython-validate-script")
170
166
  if validation_script:
171
167
  LOG.info("Exercising configured validation script: %s" % runez.short(validation_script))
@@ -173,6 +169,14 @@ class Cpython(PythonBuilder):
173
169
 
174
170
  additional = PPG.config.get_value("cpython-additional-packages")
175
171
  if additional:
172
+ # Config wants additional packages installed, ensure that `pip` is installed first
173
+ if "--with-ensurepip=no" not in self.c_configure_args_from_config:
174
+ cmd = ["-mensurepip"]
175
+ if "--with-ensurepip=install" not in self.c_configure_args_from_config:
176
+ cmd.append("--upgrade")
177
+
178
+ self.run_python(cmd)
179
+
176
180
  self.run_python("-mpip", "install", *runez.flattened(additional))
177
181
 
178
182
  check_venvs = PPG.config.get_value("cpython-check-venvs")
@@ -186,6 +190,14 @@ class Cpython(PythonBuilder):
186
190
  if PPG.config.get_value("cpython-compile-all"):
187
191
  self.run_python("-mcompileall", "-q", self.install_folder / "lib")
188
192
 
193
+ if self.config_folder:
194
+ # When --enable-shared is specified, cpython build does not produce 'lib/libpython*.a'
195
+ # Add it if build was not configured to clean up 'self.config_folder'
196
+ actual_static = self.config_folder / f"libpython{self.version.mm}.a"
197
+ symlink_static = self.install_folder / f"lib/libpython{self.version.mm}.a"
198
+ if actual_static.exists() and not symlink_static.exists():
199
+ runez.symlink(actual_static, symlink_static)
200
+
189
201
  info_path = PPG.config.get_value("manifest", "build-info")
190
202
  if info_path:
191
203
  contents = self._represented_yaml(self.build_information())
@@ -200,6 +212,11 @@ class Cpython(PythonBuilder):
200
212
 
201
213
  PPG.config.cleanup_folder(self, "cpython-clean-2nd-pass", "cpython-clean")
202
214
 
215
+ py_inspector = PythonInspector(self.install_folder)
216
+ print(py_inspector.represented())
217
+ problem = py_inspector.full_so_report.get_problem(portable=not is_shared)
218
+ runez.abort_if(problem and self.setup.x_debug != "direct-finalize", "Build failed: %s" % problem)
219
+
203
220
  def _check_venv(self, copies=False):
204
221
  """Verify that the freshly compiled python can create venvs without issue"""
205
222
  folder = "venv"
@@ -210,7 +227,7 @@ class Cpython(PythonBuilder):
210
227
 
211
228
  folder = self.setup.folders.build_folder / "test-venvs" / folder
212
229
  self.run_python(*args, folder)
213
- self.run_python("-mpip", "--version")
230
+ self._do_run(folder / "bin/pip", "--version")
214
231
 
215
232
  @staticmethod
216
233
  def _represented_yaml(bits):
@@ -272,6 +289,7 @@ class Cpython(PythonBuilder):
272
289
  rel_location = os.path.relpath(self.bin_python, path.parent)
273
290
  lines.append("#!/bin/sh\n")
274
291
  lines.append('"exec" "$(dirname $0)/%s" "$0" "$@"\n' % rel_location)
292
+ lines.append("# -*- coding: utf-8 -*-\n")
275
293
 
276
294
  except UnicodeError:
277
295
  return
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: portable-python
3
- Version: 1.8.1
3
+ Version: 1.8.3
4
4
  Summary: Portable python binaries
5
5
  Home-page: https://github.com/codrsquad/portable-python
6
6
  Author: Zoran Simic
@@ -72,7 +72,7 @@ def test_finalization(cli, monkeypatch):
72
72
  manifest = list(runez.readlines(f"build/ppp-marker/{f.version}/.manifest.yml"))
73
73
  assert " some_env: some-env-value" in manifest
74
74
  assert "selected: bzip2" in cli.logged
75
- assert "INFO Cleaned 2 build artifacts (0 B): __phello__.foo.py idle_test" in cli.logged
75
+ assert "INFO Cleaned 1 build artifact (0 B): idle_test" in cli.logged
76
76
  assert f"Symlink {bin}/foo-python <- {bin}/python" in cli.logged
77
77
  assert f"Symlink {bin}/pip{f.mm} <- {bin}/pip" in cli.logged
78
78
  assert f"Auto-corrected shebang for {bin}/some-exe" in cli.logged
@@ -80,7 +80,8 @@ def test_finalization(cli, monkeypatch):
80
80
  transformed = "\n".join(runez.readlines(sys_cfg))
81
81
  assert transformed.strip() == SAMPLE_SYS_CONF_REL.strip()
82
82
 
83
- assert list(runez.readlines(bin / "some-exe")) == ["#!/bin/sh", '"exec" "$(dirname $0)/foo-python" "$0" "$@"', "hello"]
83
+ expected = ["#!/bin/sh", '"exec" "$(dirname $0)/foo-python" "$0" "$@"', "# -*- coding: utf-8 -*-", "hello"]
84
+ assert list(runez.readlines(bin / "some-exe")) == expected
84
85
  assert list(runez.readlines(bin / "some-exe2")) == ["#!/bin/sh", "hello"]
85
86
  assert runez.basename(bin / "python", follow=True) == "foo-python"
86
87
 
@@ -4,6 +4,13 @@ def test_build_bogus_platform(cli):
4
4
  assert "Compiling on platform 'foo' is not yet supported" in cli.logged
5
5
 
6
6
 
7
+ def test_failed_build(cli):
8
+ cli.run("-tmacos-arm64", "build", "3.12.0")
9
+ assert cli.failed
10
+ assert "Error while compiling xz:5.4.5: ForbiddenHttpError" in cli.logged
11
+ assert "Overall compilation failed:" in cli.logged
12
+
13
+
7
14
  def test_invalid(cli):
8
15
  cli.run("-n", "build", "foo")
9
16
  assert cli.failed
File without changes