python3-cyberfusion-nodechup 1.3__tar.gz → 1.4.1__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 (15) hide show
  1. {python3_cyberfusion_nodechup-1.3 → python3_cyberfusion_nodechup-1.4.1}/PKG-INFO +4 -3
  2. {python3_cyberfusion_nodechup-1.3 → python3_cyberfusion_nodechup-1.4.1}/pyproject.toml +4 -3
  3. {python3_cyberfusion_nodechup-1.3 → python3_cyberfusion_nodechup-1.4.1}/src/cyberfusion/Nodechup/nodejs.py +8 -1
  4. {python3_cyberfusion_nodechup-1.3 → python3_cyberfusion_nodechup-1.4.1}/src/cyberfusion/Nodechup/utilities.py +36 -7
  5. {python3_cyberfusion_nodechup-1.3 → python3_cyberfusion_nodechup-1.4.1}/src/python3_cyberfusion_nodechup.egg-info/PKG-INFO +4 -3
  6. python3_cyberfusion_nodechup-1.4.1/src/python3_cyberfusion_nodechup.egg-info/requires.txt +4 -0
  7. python3_cyberfusion_nodechup-1.3/src/python3_cyberfusion_nodechup.egg-info/requires.txt +0 -3
  8. {python3_cyberfusion_nodechup-1.3 → python3_cyberfusion_nodechup-1.4.1}/README.md +0 -0
  9. {python3_cyberfusion_nodechup-1.3 → python3_cyberfusion_nodechup-1.4.1}/setup.cfg +0 -0
  10. {python3_cyberfusion_nodechup-1.3 → python3_cyberfusion_nodechup-1.4.1}/src/cyberfusion/Nodechup/CLI.py +0 -0
  11. {python3_cyberfusion_nodechup-1.3 → python3_cyberfusion_nodechup-1.4.1}/src/cyberfusion/Nodechup/__init__.py +0 -0
  12. {python3_cyberfusion_nodechup-1.3 → python3_cyberfusion_nodechup-1.4.1}/src/python3_cyberfusion_nodechup.egg-info/SOURCES.txt +0 -0
  13. {python3_cyberfusion_nodechup-1.3 → python3_cyberfusion_nodechup-1.4.1}/src/python3_cyberfusion_nodechup.egg-info/dependency_links.txt +0 -0
  14. {python3_cyberfusion_nodechup-1.3 → python3_cyberfusion_nodechup-1.4.1}/src/python3_cyberfusion_nodechup.egg-info/entry_points.txt +0 -0
  15. {python3_cyberfusion_nodechup-1.3 → python3_cyberfusion_nodechup-1.4.1}/src/python3_cyberfusion_nodechup.egg-info/top_level.txt +0 -0
@@ -1,13 +1,14 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python3-cyberfusion-nodechup
3
- Version: 1.3
3
+ Version: 1.4.1
4
4
  Summary: Use nodechup to install multiple Node.js versions.
5
5
  Author-email: Cyberfusion <support@cyberfusion.io>
6
6
  Project-URL: Source, https://github.com/CyberfusionIO/python3-cyberfusion-nodechup
7
7
  Description-Content-Type: text/markdown
8
8
  Requires-Dist: docopt==0.6.2
9
- Requires-Dist: schema==0.7.7
10
- Requires-Dist: requests==2.32.3
9
+ Requires-Dist: schema==0.7.8
10
+ Requires-Dist: requests==2.33.1
11
+ Requires-Dist: semantic-version==2.10.0
11
12
 
12
13
  # python3-cyberfusion-nodechup
13
14
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "python3-cyberfusion-nodechup"
7
- version = "1.3"
7
+ version = "1.4.1"
8
8
  description = "Use nodechup to install multiple Node.js versions."
9
9
  readme = "README.md"
10
10
  authors = [
@@ -12,8 +12,9 @@ authors = [
12
12
  ]
13
13
  dependencies = [
14
14
  "docopt==0.6.2",
15
- "schema==0.7.7",
16
- "requests==2.32.3",
15
+ "schema==0.7.8",
16
+ "requests==2.33.1",
17
+ "semantic-version==2.10.0",
17
18
  ]
18
19
 
19
20
  [project.urls]
@@ -149,7 +149,14 @@ class Installation:
149
149
 
150
150
  os.unlink(self.PATH_ARCHIVE)
151
151
 
152
- # Update default version
152
+ # Symlink major/minor/point (e.g. 22.16.0 -> node-v22.16.0-linux-x64)
153
+
154
+ os.symlink(
155
+ self._version_path,
156
+ os.path.join(self.base_directory.path, str(self.version)),
157
+ )
158
+
159
+ # Update default version (e.g. 22.16 (no point) -> node-v22.16.0-linux-x64)
153
160
 
154
161
  if update_default_version:
155
162
  self.base_directory.set_default_version(self._version_path, self.version)
@@ -4,7 +4,8 @@ import codecs
4
4
  import csv
5
5
  import platform
6
6
  import urllib.request
7
- from typing import List, Tuple
7
+
8
+ import semantic_version
8
9
 
9
10
  URL_MIRROR = "https://nodejs.org/dist"
10
11
  URL_VERSIONS_TAB = f"{URL_MIRROR}/index.tab"
@@ -13,24 +14,31 @@ LONG_X86_64 = "x86_64"
13
14
  SHORT_X86_64 = "x64"
14
15
 
15
16
 
16
- def _get_versions() -> List[Tuple[int, int, int]]:
17
+ class NodeJSUnexpectedVersionFormat(Exception):
18
+ """Raised when the version format we see in the versions index tab is unexpected.
19
+
20
+ This currently applies to encountering build tags in release versions mentioned in the tab, which
21
+ will need separate logic to handle it.
22
+ """
23
+
24
+
25
+ def _get_versions() -> list[tuple[int, int, int]]:
17
26
  """Get available Node.js versions."""
18
27
  versions = []
19
28
 
20
29
  _csv = csv.DictReader(
21
30
  codecs.iterdecode(
22
31
  urllib.request.urlopen(URL_VERSIONS_TAB),
23
- "utf-8", # noqa: S310
32
+ "utf-8",
24
33
  ),
25
34
  delimiter="\t",
26
35
  )
27
36
 
28
37
  for row in _csv:
29
- major, minor, point = row["version"][len("v") :].split(
30
- "."
31
- ) # Remove leading 'v'
38
+ major, minor, point, release = _parse_semver(row["version"])
32
39
 
33
- versions.append((int(major), int(minor), int(point)))
40
+ if release:
41
+ versions.append((major, minor, point))
34
42
 
35
43
  return versions
36
44
 
@@ -57,6 +65,27 @@ def get_latest_point_release(major: int, minor: int) -> int:
57
65
  return max(versions)
58
66
 
59
67
 
68
+ def _parse_semver(version: str) -> tuple[int, int, int, bool]:
69
+ """Parse a semantic version X.Y.Z, with optional `v` prefix and `-<pre-release tag>` suffix.
70
+
71
+ Returns `major`, `minor`, `patch` version components, and whether this version is an actual release version.
72
+
73
+ If build tag is present, NodeJSUnexpectedVersionFormat exception is raised."""
74
+ parsed = semantic_version.Version(version.removeprefix("v"))
75
+
76
+ if parsed.build:
77
+ raise NodeJSUnexpectedVersionFormat(
78
+ "build tags in parsed NodeJS versions are unsupported"
79
+ )
80
+
81
+ return (
82
+ parsed.major,
83
+ parsed.minor,
84
+ parsed.patch,
85
+ not parsed.prerelease,
86
+ )
87
+
88
+
60
89
  def get_architecture() -> str:
61
90
  """Get architecture that Node.js repos know about."""
62
91
  architecture = platform.machine()
@@ -1,13 +1,14 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python3-cyberfusion-nodechup
3
- Version: 1.3
3
+ Version: 1.4.1
4
4
  Summary: Use nodechup to install multiple Node.js versions.
5
5
  Author-email: Cyberfusion <support@cyberfusion.io>
6
6
  Project-URL: Source, https://github.com/CyberfusionIO/python3-cyberfusion-nodechup
7
7
  Description-Content-Type: text/markdown
8
8
  Requires-Dist: docopt==0.6.2
9
- Requires-Dist: schema==0.7.7
10
- Requires-Dist: requests==2.32.3
9
+ Requires-Dist: schema==0.7.8
10
+ Requires-Dist: requests==2.33.1
11
+ Requires-Dist: semantic-version==2.10.0
11
12
 
12
13
  # python3-cyberfusion-nodechup
13
14
 
@@ -0,0 +1,4 @@
1
+ docopt==0.6.2
2
+ schema==0.7.8
3
+ requests==2.33.1
4
+ semantic-version==2.10.0
@@ -1,3 +0,0 @@
1
- docopt==0.6.2
2
- schema==0.7.7
3
- requests==2.32.3