portable-python 1.9.8__tar.gz → 1.9.9__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.9.8/src/portable_python.egg-info → portable_python-1.9.9}/PKG-INFO +1 -1
  2. {portable_python-1.9.8 → portable_python-1.9.9}/pyproject.toml +1 -1
  3. {portable_python-1.9.8 → portable_python-1.9.9}/src/portable_python/__init__.py +34 -2
  4. {portable_python-1.9.8 → portable_python-1.9.9}/src/portable_python/external/__init__.py +1 -1
  5. {portable_python-1.9.8 → portable_python-1.9.9/src/portable_python.egg-info}/PKG-INFO +1 -1
  6. {portable_python-1.9.8 → portable_python-1.9.9}/tests/test_setup.py +7 -0
  7. {portable_python-1.9.8 → portable_python-1.9.9}/DEVELOP.md +0 -0
  8. {portable_python-1.9.8 → portable_python-1.9.9}/LICENSE +0 -0
  9. {portable_python-1.9.8 → portable_python-1.9.9}/MANIFEST.in +0 -0
  10. {portable_python-1.9.8 → portable_python-1.9.9}/README.rst +0 -0
  11. {portable_python-1.9.8 → portable_python-1.9.9}/SECURITY.md +0 -0
  12. {portable_python-1.9.8 → portable_python-1.9.9}/requirements.txt +0 -0
  13. {portable_python-1.9.8 → portable_python-1.9.9}/setup.cfg +0 -0
  14. {portable_python-1.9.8 → portable_python-1.9.9}/setup.py +0 -0
  15. {portable_python-1.9.8 → portable_python-1.9.9}/src/portable_python/__main__.py +0 -0
  16. {portable_python-1.9.8 → portable_python-1.9.9}/src/portable_python/cli.py +0 -0
  17. {portable_python-1.9.8 → portable_python-1.9.9}/src/portable_python/config.py +0 -0
  18. {portable_python-1.9.8 → portable_python-1.9.9}/src/portable_python/cpython.py +0 -0
  19. {portable_python-1.9.8 → portable_python-1.9.9}/src/portable_python/external/_inspect.py +0 -0
  20. {portable_python-1.9.8 → portable_python-1.9.9}/src/portable_python/external/xcpython.py +0 -0
  21. {portable_python-1.9.8 → portable_python-1.9.9}/src/portable_python/external/xtkinter.py +0 -0
  22. {portable_python-1.9.8 → portable_python-1.9.9}/src/portable_python/inspector.py +0 -0
  23. {portable_python-1.9.8 → portable_python-1.9.9}/src/portable_python/tracking.py +0 -0
  24. {portable_python-1.9.8 → portable_python-1.9.9}/src/portable_python/versions.py +0 -0
  25. {portable_python-1.9.8 → portable_python-1.9.9}/src/portable_python.egg-info/SOURCES.txt +0 -0
  26. {portable_python-1.9.8 → portable_python-1.9.9}/src/portable_python.egg-info/dependency_links.txt +0 -0
  27. {portable_python-1.9.8 → portable_python-1.9.9}/src/portable_python.egg-info/entry_points.txt +0 -0
  28. {portable_python-1.9.8 → portable_python-1.9.9}/src/portable_python.egg-info/requires.txt +0 -0
  29. {portable_python-1.9.8 → portable_python-1.9.9}/src/portable_python.egg-info/top_level.txt +0 -0
  30. {portable_python-1.9.8 → portable_python-1.9.9}/tests/test_build.py +0 -0
  31. {portable_python-1.9.8 → portable_python-1.9.9}/tests/test_cleanup.py +0 -0
  32. {portable_python-1.9.8 → portable_python-1.9.9}/tests/test_failed.py +0 -0
  33. {portable_python-1.9.8 → portable_python-1.9.9}/tests/test_inspector.py +0 -0
  34. {portable_python-1.9.8 → portable_python-1.9.9}/tests/test_invoker.py +0 -0
  35. {portable_python-1.9.8 → portable_python-1.9.9}/tests/test_list.py +0 -0
  36. {portable_python-1.9.8 → portable_python-1.9.9}/tests/test_prefix.py +0 -0
  37. {portable_python-1.9.8 → portable_python-1.9.9}/tests/test_recompress.py +0 -0
  38. {portable_python-1.9.8 → portable_python-1.9.9}/tests/test_report.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: portable-python
3
- Version: 1.9.8
3
+ Version: 1.9.9
4
4
  Summary: Portable python binaries
5
5
  Home-page: https://github.com/codrsquad/portable-python
6
6
  Author: Zoran Simic
@@ -63,7 +63,7 @@ ignore = [
63
63
  order-by-type = false
64
64
 
65
65
  [tool.ruff.lint.mccabe]
66
- max-complexity = 14
66
+ max-complexity = 18
67
67
 
68
68
  [tool.ruff.lint.pydocstyle]
69
69
  convention = "numpy"
@@ -492,10 +492,23 @@ class ModuleBuilder:
492
492
  def cfg_version(self, default):
493
493
  return PPG.config.get_value("%s-version" % self.m_name) or default
494
494
 
495
+ def cfg_http_headers(self):
496
+ if config_http_headers := PPG.config.get_value("%s-http-headers" % self.m_name):
497
+ expanded_http_headers = {}
498
+ for header_dict in config_http_headers:
499
+ for key, value in header_dict.items():
500
+ expanded_http_headers[os.path.expandvars(key)] = os.path.expandvars(value)
501
+
502
+ return expanded_http_headers
503
+
495
504
  def cfg_url(self, version):
496
505
  if config_url := PPG.config.get_value("%s-url" % self.m_name):
497
506
  url_template = Template(config_url)
498
- return url_template.substitute(version=version)
507
+ url_subbed = url_template.substitute(version=version)
508
+ return os.path.expandvars(url_subbed)
509
+
510
+ def cfg_src_suffix(self):
511
+ return PPG.config.get_value("%s-src-suffix" % self.m_name)
499
512
 
500
513
  def cfg_configure(self, deps_lib_dir, deps_lib64_dir):
501
514
  if configure := PPG.config.get_value("%s-configure" % self.m_name):
@@ -510,6 +523,16 @@ class ModuleBuilder:
510
523
  """Url of source tarball, if any"""
511
524
  return ""
512
525
 
526
+ @property
527
+ def headers(self):
528
+ """Headers for connecting to source url, if any"""
529
+ return self.cfg_http_headers()
530
+
531
+ @property
532
+ def src_suffix(self):
533
+ """Suffix of src archive for when URL doesn't end in the file extension"""
534
+ return self.cfg_src_suffix()
535
+
513
536
  @property
514
537
  def version(self):
515
538
  """Version to use"""
@@ -632,8 +655,16 @@ class ModuleBuilder:
632
655
  self._finalize()
633
656
  return
634
657
 
658
+ # Some URL's may not end in file extension, such as with redirects.
659
+ # Github releases asset endpoint is this way .../releases/assets/48151
660
+
635
661
  # Split on '#' for urls that include a checksum, such as #sha256=... fragment
636
662
  basename = runez.basename(self.url, extension_marker="#")
663
+ if not basename.endswith((".zip", ".tar.gz")):
664
+ suffix = self.src_suffix or ".tar.gz"
665
+ suffix = ".%s" % (suffix.strip(".")) # Ensure it starts with a dot (in case config forgot leading dot)
666
+ basename = f"{self.m_name}-{self.version}{suffix}"
667
+
637
668
  path = self.setup.folders.sources / basename
638
669
  if not path.exists():
639
670
  proxies = {}
@@ -643,7 +674,8 @@ class ModuleBuilder:
643
674
  https_proxy = os.environ.get("HTTPS_PROXY") or os.environ.get("https_proxy")
644
675
  if https_proxy:
645
676
  proxies["https"] = https_proxy
646
- RestClient().download(self.url, path, proxies=proxies)
677
+
678
+ RestClient().download(self.url, path, proxies=proxies, headers=self.headers)
647
679
 
648
680
  runez.decompress(path, self.m_src_build, simplify=True)
649
681
 
@@ -6,7 +6,7 @@ class GettextTiny(ModuleBuilder):
6
6
 
7
7
  @property
8
8
  def url(self):
9
- return f"https://github.com/sabotage-linux/gettext-tiny/archive/refs/tags/v{self.version}.tar.gz"
9
+ return self.cfg_url(self.version) or f"https://github.com/sabotage-linux/gettext-tiny/archive/refs/tags/v{self.version}.tar.gz"
10
10
 
11
11
  @property
12
12
  def version(self):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: portable-python
3
- Version: 1.9.8
3
+ Version: 1.9.9
4
4
  Summary: Portable python binaries
5
5
  Home-page: https://github.com/codrsquad/portable-python
6
6
  Author: Zoran Simic
@@ -9,8 +9,15 @@ def test_config(cli):
9
9
  with pytest.raises(runez.system.AbortException):
10
10
  PPG.config.parsed_yaml("a: b\ninvalid line", "testing")
11
11
 
12
+ # Exercise custom url in config
13
+ cli.run("-ntmacos-arm64", "-c", cli.tests_path("sample-config1.yml"), "build", "3.9.7", "-mbzip2")
14
+ assert cli.succeeded
15
+ assert "Would download https://my-enterprise/.../assets/bzip2/123#sha256=123...def\n" in cli.logged
16
+ assert "Would untar build/sources/bzip2-1.2.3.tar.gz -> build/components/bzip2\n" in cli.logged
17
+
12
18
  cli.run("-ntmacos-arm64", "-c", cli.tests_path("sample-config1.yml"), "build", "3.9.7", "-mnone")
13
19
  assert cli.succeeded
20
+
14
21
  assert " -mpip install --no-cache-dir --upgrade my-additional-package" in cli.logged
15
22
  assert "env MACOSX_DEPLOYMENT_TARGET=12" in cli.logged # Comes from more specific macos-arm64.yml
16
23
  assert " -> dist/cpython-3.9.7-macos-arm64.tar.xz" in cli.logged # Comes from macos.yml (not defined in macos-arm64.yml)
File without changes