ducktools-pythonfinder 0.4.5__tar.gz → 0.4.7__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. {ducktools_pythonfinder-0.4.5/src/ducktools_pythonfinder.egg-info → ducktools_pythonfinder-0.4.7}/PKG-INFO +1 -1
  2. ducktools_pythonfinder-0.4.7/src/ducktools/pythonfinder/_version.py +2 -0
  3. {ducktools_pythonfinder-0.4.5 → ducktools_pythonfinder-0.4.7}/src/ducktools/pythonfinder/shared.py +3 -0
  4. ducktools_pythonfinder-0.4.7/src/ducktools/pythonfinder/win32/pyenv_search.py +81 -0
  5. {ducktools_pythonfinder-0.4.5 → ducktools_pythonfinder-0.4.7/src/ducktools_pythonfinder.egg-info}/PKG-INFO +1 -1
  6. ducktools_pythonfinder-0.4.5/src/ducktools/pythonfinder/_version.py +0 -2
  7. ducktools_pythonfinder-0.4.5/src/ducktools/pythonfinder/win32/pyenv_search.py +0 -69
  8. {ducktools_pythonfinder-0.4.5 → ducktools_pythonfinder-0.4.7}/.gitignore +0 -0
  9. {ducktools_pythonfinder-0.4.5 → ducktools_pythonfinder-0.4.7}/LICENSE +0 -0
  10. {ducktools_pythonfinder-0.4.5 → ducktools_pythonfinder-0.4.7}/MANIFEST.in +0 -0
  11. {ducktools_pythonfinder-0.4.5 → ducktools_pythonfinder-0.4.7}/README.md +0 -0
  12. {ducktools_pythonfinder-0.4.5 → ducktools_pythonfinder-0.4.7}/pyproject.toml +0 -0
  13. {ducktools_pythonfinder-0.4.5 → ducktools_pythonfinder-0.4.7}/scripts/build_zipapp.py +0 -0
  14. {ducktools_pythonfinder-0.4.5 → ducktools_pythonfinder-0.4.7}/scripts/detail_this_python.py +0 -0
  15. {ducktools_pythonfinder-0.4.5 → ducktools_pythonfinder-0.4.7}/scripts/print_python_versions.py +0 -0
  16. {ducktools_pythonfinder-0.4.5 → ducktools_pythonfinder-0.4.7}/setup.cfg +0 -0
  17. {ducktools_pythonfinder-0.4.5 → ducktools_pythonfinder-0.4.7}/src/ducktools/pythonfinder/__init__.py +0 -0
  18. {ducktools_pythonfinder-0.4.5 → ducktools_pythonfinder-0.4.7}/src/ducktools/pythonfinder/__main__.py +0 -0
  19. {ducktools_pythonfinder-0.4.5 → ducktools_pythonfinder-0.4.7}/src/ducktools/pythonfinder/darwin/__init__.py +0 -0
  20. {ducktools_pythonfinder-0.4.5 → ducktools_pythonfinder-0.4.7}/src/ducktools/pythonfinder/details_script.py +0 -0
  21. {ducktools_pythonfinder-0.4.5 → ducktools_pythonfinder-0.4.7}/src/ducktools/pythonfinder/linux/__init__.py +0 -0
  22. {ducktools_pythonfinder-0.4.5 → ducktools_pythonfinder-0.4.7}/src/ducktools/pythonfinder/linux/pyenv_search.py +0 -0
  23. {ducktools_pythonfinder-0.4.5 → ducktools_pythonfinder-0.4.7}/src/ducktools/pythonfinder/pythonorg_search.py +0 -0
  24. {ducktools_pythonfinder-0.4.5 → ducktools_pythonfinder-0.4.7}/src/ducktools/pythonfinder/win32/__init__.py +0 -0
  25. {ducktools_pythonfinder-0.4.5 → ducktools_pythonfinder-0.4.7}/src/ducktools/pythonfinder/win32/registry_search.py +0 -0
  26. {ducktools_pythonfinder-0.4.5 → ducktools_pythonfinder-0.4.7}/src/ducktools_pythonfinder.egg-info/SOURCES.txt +0 -0
  27. {ducktools_pythonfinder-0.4.5 → ducktools_pythonfinder-0.4.7}/src/ducktools_pythonfinder.egg-info/dependency_links.txt +0 -0
  28. {ducktools_pythonfinder-0.4.5 → ducktools_pythonfinder-0.4.7}/src/ducktools_pythonfinder.egg-info/requires.txt +0 -0
  29. {ducktools_pythonfinder-0.4.5 → ducktools_pythonfinder-0.4.7}/src/ducktools_pythonfinder.egg-info/top_level.txt +0 -0
  30. {ducktools_pythonfinder-0.4.5 → ducktools_pythonfinder-0.4.7}/tests/conftest.py +0 -0
  31. {ducktools_pythonfinder-0.4.5 → ducktools_pythonfinder-0.4.7}/tests/sources/python_versions.txt +0 -0
  32. {ducktools_pythonfinder-0.4.5 → ducktools_pythonfinder-0.4.7}/tests/sources/release.json +0 -0
  33. {ducktools_pythonfinder-0.4.5 → ducktools_pythonfinder-0.4.7}/tests/sources/release_file.json +0 -0
  34. {ducktools_pythonfinder-0.4.5 → ducktools_pythonfinder-0.4.7}/tests/test_details_script.py +0 -0
  35. {ducktools_pythonfinder-0.4.5 → ducktools_pythonfinder-0.4.7}/tests/test_foldersearch.py +0 -0
  36. {ducktools_pythonfinder-0.4.5 → ducktools_pythonfinder-0.4.7}/tests/test_orgsearch.py +0 -0
  37. {ducktools_pythonfinder-0.4.5 → ducktools_pythonfinder-0.4.7}/tests/test_pyenv.py +0 -0
  38. {ducktools_pythonfinder-0.4.5 → ducktools_pythonfinder-0.4.7}/tests/test_shared.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ducktools-pythonfinder
3
- Version: 0.4.5
3
+ Version: 0.4.7
4
4
  Summary: Cross platform tool to find available python installations
5
5
  Author: David C Ellis
6
6
  Project-URL: Homepage, https://github.com/davidcellis/ducktools-pythonfinder
@@ -0,0 +1,2 @@
1
+ __version__ = "0.4.7"
2
+ __version_tuple__ = (0, 4, 7)
@@ -112,6 +112,9 @@ class DetailsScript:
112
112
  self._source_code = f.read()
113
113
  elif os.path.splitext(archive_path := sys.argv[0])[1].startswith(".pyz"):
114
114
  script_path = os.path.relpath(details_script.__file__, archive_path)
115
+ if sys.platform == "win32":
116
+ # Windows paths have backslashes, these do not work in zipfiles
117
+ script_path = script_path.replace("\\", "/")
115
118
  script = _laz.zipfile.Path(archive_path, script_path)
116
119
  self._source_code = script.read_text()
117
120
  else:
@@ -0,0 +1,81 @@
1
+ # ducktools-pythonfinder
2
+ # MIT License
3
+ #
4
+ # Copyright (c) 2023-2024 David C Ellis
5
+ #
6
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ # of this software and associated documentation files (the "Software"), to deal
8
+ # in the Software without restriction, including without limitation the rights
9
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ # copies of the Software, and to permit persons to whom the Software is
11
+ # furnished to do so, subject to the following conditions:
12
+ #
13
+ # The above copyright notice and this permission notice shall be included in all
14
+ # copies or substantial portions of the Software.
15
+ #
16
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ # SOFTWARE.
23
+ from __future__ import annotations
24
+
25
+ import os
26
+ import os.path
27
+ from _collections_abc import Iterator
28
+
29
+ from ..shared import PythonInstall, get_install_details
30
+
31
+
32
+ PYENV_VERSIONS_FOLDER = os.path.join(os.environ.get("PYENV_ROOT", ""), "versions")
33
+
34
+
35
+ def get_pyenv_pythons(
36
+ versions_folder: str | os.PathLike = PYENV_VERSIONS_FOLDER,
37
+ ) -> Iterator[PythonInstall]:
38
+ if not os.path.exists(versions_folder):
39
+ return
40
+
41
+ for p in os.scandir(versions_folder):
42
+ path_base = os.path.basename(p.path)
43
+
44
+ if path_base.startswith("pypy"):
45
+ executable = os.path.join(p.path, "pypy.exe")
46
+ if os.path.exists(executable):
47
+ yield get_install_details(executable)
48
+ elif path_base.startswith("graalpy"):
49
+ # Graalpy exe in bin subfolder
50
+ executable = os.path.join(p.path, "bin", "graalpy.exe")
51
+ if os.path.exists(executable):
52
+ yield get_install_details(executable)
53
+ else:
54
+ # Regular CPython
55
+ executable = os.path.join(p.path, "python.exe")
56
+
57
+ if os.path.exists(executable):
58
+ split_version = p.name.split("-")
59
+
60
+ # If there are 1 or 2 arguments this is a recognised version
61
+ # Otherwise it is unrecognised
62
+ if len(split_version) == 2:
63
+ version, arch = split_version
64
+
65
+ # win32 in pyenv name means 32 bit python install
66
+ # 'arm' is the only alternative which will be 64bit
67
+ arch = "32bit" if arch == "win32" else "64bit"
68
+ try:
69
+ yield PythonInstall.from_str(
70
+ version, executable, architecture=arch
71
+ )
72
+ except ValueError:
73
+ pass
74
+ elif len(split_version) == 1:
75
+ version = split_version[0]
76
+ try:
77
+ yield PythonInstall.from_str(
78
+ version, executable, architecture="64bit"
79
+ )
80
+ except ValueError:
81
+ pass
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ducktools-pythonfinder
3
- Version: 0.4.5
3
+ Version: 0.4.7
4
4
  Summary: Cross platform tool to find available python installations
5
5
  Author: David C Ellis
6
6
  Project-URL: Homepage, https://github.com/davidcellis/ducktools-pythonfinder
@@ -1,2 +0,0 @@
1
- __version__ = "0.4.5"
2
- __version_tuple__ = (0, 4, 5)
@@ -1,69 +0,0 @@
1
- # ducktools-pythonfinder
2
- # MIT License
3
- #
4
- # Copyright (c) 2023-2024 David C Ellis
5
- #
6
- # Permission is hereby granted, free of charge, to any person obtaining a copy
7
- # of this software and associated documentation files (the "Software"), to deal
8
- # in the Software without restriction, including without limitation the rights
9
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- # copies of the Software, and to permit persons to whom the Software is
11
- # furnished to do so, subject to the following conditions:
12
- #
13
- # The above copyright notice and this permission notice shall be included in all
14
- # copies or substantial portions of the Software.
15
- #
16
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- # SOFTWARE.
23
- from __future__ import annotations
24
-
25
- import os
26
- import os.path
27
- from _collections_abc import Iterator
28
-
29
- from ..shared import PythonInstall
30
-
31
-
32
- PYENV_VERSIONS_FOLDER = os.path.join(os.environ.get("PYENV_ROOT", ""), "versions")
33
-
34
-
35
- def get_pyenv_pythons(
36
- versions_folder: str | os.PathLike = PYENV_VERSIONS_FOLDER,
37
- ) -> Iterator[PythonInstall]:
38
- if not os.path.exists(versions_folder):
39
- return
40
-
41
- for p in os.scandir(versions_folder):
42
- executable = os.path.join(p.path, "python.exe")
43
-
44
- if os.path.exists(executable):
45
- split_version = p.name.split("-")
46
-
47
- # If there are 1 or 2 arguments this is a recognised version
48
- # Otherwise it is unrecognised
49
- if len(split_version) == 2:
50
- version, arch = split_version
51
-
52
- # win32 in pyenv name means 32 bit python install
53
- # 'arm' is the only alternative which will be 64bit
54
- arch = "32bit" if arch == "win32" else "64bit"
55
- try:
56
- yield PythonInstall.from_str(
57
- version, executable, architecture=arch
58
- )
59
- except ValueError:
60
- pass
61
- elif len(split_version) == 1:
62
- version = split_version[0]
63
- try:
64
- yield PythonInstall.from_str(
65
- version, executable, architecture="64bit"
66
- )
67
- except ValueError:
68
- pass
69
-