ducktools-pythonfinder 0.1.0__tar.gz → 0.2.0__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 (42) hide show
  1. ducktools_pythonfinder-0.2.0/.github/dependabot.yml +7 -0
  2. ducktools_pythonfinder-0.2.0/.github/workflows/auto_test.yml +31 -0
  3. ducktools_pythonfinder-0.2.0/.github/workflows/publish_to_pypi.yml +86 -0
  4. ducktools_pythonfinder-0.2.0/.github/workflows/publish_to_testpypi.yml +55 -0
  5. ducktools_pythonfinder-0.2.0/.gitignore +157 -0
  6. ducktools_pythonfinder-0.2.0/LICENSE +21 -0
  7. {ducktools-pythonfinder-0.1.0/src/ducktools_pythonfinder.egg-info → ducktools_pythonfinder-0.2.0}/PKG-INFO +8 -7
  8. {ducktools-pythonfinder-0.1.0 → ducktools_pythonfinder-0.2.0}/README.md +1 -1
  9. {ducktools-pythonfinder-0.1.0 → ducktools_pythonfinder-0.2.0}/pyproject.toml +9 -7
  10. ducktools-pythonfinder-0.1.0/src/ducktools/pythonfinder/darwin/__init__.py → ducktools_pythonfinder-0.2.0/scripts/detail_this_python.py +8 -2
  11. ducktools_pythonfinder-0.2.0/scripts/print_python_versions.py +8 -0
  12. ducktools_pythonfinder-0.2.0/src/ducktools/pythonfinder/__init__.py +46 -0
  13. {ducktools-pythonfinder-0.1.0 → ducktools_pythonfinder-0.2.0}/src/ducktools/pythonfinder/__main__.py +18 -11
  14. ducktools_pythonfinder-0.2.0/src/ducktools/pythonfinder/_version.py +16 -0
  15. ducktools_pythonfinder-0.2.0/src/ducktools/pythonfinder/darwin/__init__.py +26 -0
  16. ducktools_pythonfinder-0.2.0/src/ducktools/pythonfinder/details_script.py +65 -0
  17. ducktools_pythonfinder-0.2.0/src/ducktools/pythonfinder/linux/__init__.py +61 -0
  18. {ducktools-pythonfinder-0.1.0 → ducktools_pythonfinder-0.2.0}/src/ducktools/pythonfinder/linux/pyenv_search.py +20 -11
  19. {ducktools-pythonfinder-0.1.0 → ducktools_pythonfinder-0.2.0}/src/ducktools/pythonfinder/shared.py +47 -34
  20. ducktools_pythonfinder-0.2.0/src/ducktools/pythonfinder/win32/__init__.py +38 -0
  21. ducktools_pythonfinder-0.2.0/src/ducktools/pythonfinder/win32/pyenv_search.py +69 -0
  22. {ducktools-pythonfinder-0.1.0 → ducktools_pythonfinder-0.2.0}/src/ducktools/pythonfinder/win32/registry_search.py +19 -12
  23. {ducktools-pythonfinder-0.1.0 → ducktools_pythonfinder-0.2.0/src/ducktools_pythonfinder.egg-info}/PKG-INFO +8 -7
  24. {ducktools-pythonfinder-0.1.0 → ducktools_pythonfinder-0.2.0}/src/ducktools_pythonfinder.egg-info/SOURCES.txt +9 -2
  25. {ducktools-pythonfinder-0.1.0 → ducktools_pythonfinder-0.2.0}/src/ducktools_pythonfinder.egg-info/requires.txt +1 -1
  26. ducktools_pythonfinder-0.2.0/tests/test_details_script.py +49 -0
  27. {ducktools-pythonfinder-0.1.0 → ducktools_pythonfinder-0.2.0}/tests/test_foldersearch.py +18 -11
  28. {ducktools-pythonfinder-0.1.0 → ducktools_pythonfinder-0.2.0}/tests/test_pyenv.py +18 -11
  29. {ducktools-pythonfinder-0.1.0 → ducktools_pythonfinder-0.2.0}/tests/test_shared.py +18 -11
  30. ducktools-pythonfinder-0.1.0/COPYING +0 -674
  31. ducktools-pythonfinder-0.1.0/COPYING.LESSER +0 -165
  32. ducktools-pythonfinder-0.1.0/src/ducktools/pythonfinder/__init__.py +0 -40
  33. ducktools-pythonfinder-0.1.0/src/ducktools/pythonfinder/details_script.py +0 -58
  34. ducktools-pythonfinder-0.1.0/src/ducktools/pythonfinder/linux/__init__.py +0 -53
  35. ducktools-pythonfinder-0.1.0/src/ducktools/pythonfinder/win32/__init__.py +0 -14
  36. ducktools-pythonfinder-0.1.0/src/ducktools/pythonfinder/win32/pyenv_search.py +0 -57
  37. ducktools-pythonfinder-0.1.0/tests/test_details_script.py +0 -42
  38. {ducktools-pythonfinder-0.1.0 → ducktools_pythonfinder-0.2.0}/MANIFEST.in +0 -0
  39. {ducktools-pythonfinder-0.1.0 → ducktools_pythonfinder-0.2.0}/setup.cfg +0 -0
  40. {ducktools-pythonfinder-0.1.0 → ducktools_pythonfinder-0.2.0}/src/ducktools_pythonfinder.egg-info/dependency_links.txt +0 -0
  41. {ducktools-pythonfinder-0.1.0 → ducktools_pythonfinder-0.2.0}/src/ducktools_pythonfinder.egg-info/top_level.txt +0 -0
  42. {ducktools-pythonfinder-0.1.0 → ducktools_pythonfinder-0.2.0}/tests/sources/python_versions.txt +0 -0
@@ -0,0 +1,7 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "github-actions"
4
+ directory: "/"
5
+ schedule:
6
+ # Check for updates to GitHub Actions every week
7
+ interval: "weekly"
@@ -0,0 +1,31 @@
1
+ name: UnitTests
2
+
3
+ on:
4
+ push:
5
+ branches: [ "main" ]
6
+ pull_request:
7
+ branches: [ "main" ]
8
+
9
+ jobs:
10
+ run-tests:
11
+
12
+ runs-on: ${{ matrix.os }}
13
+ strategy:
14
+ fail-fast: false
15
+ matrix:
16
+ os: [ubuntu-latest, windows-latest, macos-latest]
17
+ python-version: ["3.12", "3.11", "3.10", "3.9", "3.8"]
18
+
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+ - name: Set up Python ${{ matrix.python-version }}
22
+ uses: actions/setup-python@v5
23
+ with:
24
+ python-version: ${{ matrix.python-version }}
25
+ - name: Install dependencies
26
+ run: |
27
+ python -m pip install --upgrade pip
28
+ python -m pip install -e .[testing]
29
+ - name: Test with pytest
30
+ run: |
31
+ pytest tests/
@@ -0,0 +1,86 @@
1
+ name: Publish Package to PyPi
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ build:
9
+ name: Build distribution 📦
10
+ runs-on: ubuntu-latest
11
+
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ - name: Set up Python
15
+ uses: actions/setup-python@v5
16
+ with:
17
+ python-version: "3.10"
18
+ - name: Install pypa/build
19
+ run: >-
20
+ python3 -m
21
+ pip install
22
+ build
23
+ --user
24
+ - name: Build a binary wheel and a source tarball
25
+ run: python3 -m build
26
+ - name: Store the distribution packages
27
+ uses: actions/upload-artifact@v4
28
+ with:
29
+ name: python-package-distributions
30
+ path: dist/
31
+
32
+ publish-to-pypi:
33
+ name: >-
34
+ Publish Python 🐍 distribution 📦 to PyPI
35
+ needs:
36
+ - build
37
+ runs-on: ubuntu-latest
38
+ environment:
39
+ name: pypi
40
+ url: https://pypi.org/p/ducktools-pythonfinder
41
+ permissions:
42
+ id-token: write # IMPORTANT: mandatory for trusted publishing
43
+
44
+ steps:
45
+ - name: Download all the dists
46
+ uses: actions/download-artifact@v4
47
+ with:
48
+ name: python-package-distributions
49
+ path: dist/
50
+ - name: Publish distribution 📦 to PyPI
51
+ uses: pypa/gh-action-pypi-publish@release/v1
52
+
53
+ github-release:
54
+ name: >-
55
+ Sign the Python 🐍 distribution 📦 with Sigstore
56
+ and upload them to GitHub Release
57
+ needs:
58
+ - publish-to-pypi
59
+ runs-on: ubuntu-latest
60
+
61
+ permissions:
62
+ contents: write # IMPORTANT: mandatory for making GitHub Releases
63
+ id-token: write # IMPORTANT: mandatory for sigstore
64
+
65
+ steps:
66
+ - name: Download all the dists
67
+ uses: actions/download-artifact@v4
68
+ with:
69
+ name: python-package-distributions
70
+ path: dist/
71
+ - name: Sign the dists with Sigstore
72
+ uses: sigstore/gh-action-sigstore-python@v2.1.1
73
+ with:
74
+ inputs: >-
75
+ ./dist/*.tar.gz
76
+ ./dist/*.whl
77
+ - name: Upload artifact signatures to GitHub Release
78
+ env:
79
+ GITHUB_TOKEN: ${{ github.token }}
80
+ # Upload to GitHub Release using the `gh` CLI.
81
+ # `dist/` contains the built packages, and the
82
+ # sigstore-produced signatures and certificates.
83
+ run: >-
84
+ gh release upload
85
+ '${{ github.ref_name }}' dist/**
86
+ --repo '${{ github.repository }}'
@@ -0,0 +1,55 @@
1
+ name: Test Publish Package to TestPyPi
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v[0-9]+.[0-9]+.[0-9]+*"
7
+
8
+ jobs:
9
+ build:
10
+ name: Build distribution 📦
11
+ runs-on: ubuntu-latest
12
+
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - name: Set up Python
16
+ uses: actions/setup-python@v5
17
+ with:
18
+ python-version: "3.10"
19
+ - name: Install pypa/build
20
+ run: >-
21
+ python3 -m
22
+ pip install
23
+ build
24
+ --user
25
+ - name: Build a binary wheel and a source tarball
26
+ run: python3 -m build
27
+ - name: Store the distribution packages
28
+ uses: actions/upload-artifact@v4
29
+ with:
30
+ name: python-package-distributions
31
+ path: dist/
32
+
33
+ publish-to-testpypi:
34
+ name: Publish Python 🐍 distribution 📦 to TestPyPI
35
+ needs:
36
+ - build
37
+ runs-on: ubuntu-latest
38
+
39
+ environment:
40
+ name: testpypi
41
+ url: https://test.pypi.org/p/ducktools-pythonfinder
42
+
43
+ permissions:
44
+ id-token: write # IMPORTANT: mandatory for trusted publishing
45
+
46
+ steps:
47
+ - name: Download all the dists
48
+ uses: actions/download-artifact@v4
49
+ with:
50
+ name: python-package-distributions
51
+ path: dist/
52
+ - name: Publish distribution 📦 to TestPyPI
53
+ uses: pypa/gh-action-pypi-publish@release/v1
54
+ with:
55
+ repository-url: https://test.pypi.org/legacy/
@@ -0,0 +1,157 @@
1
+ # VSCode folder
2
+ .vscode/
3
+
4
+ # IntelliJ project files
5
+ .idea
6
+ *.iml
7
+ out
8
+ gen
9
+
10
+ ### Python template
11
+ # Byte-compiled / optimized / DLL files
12
+ __pycache__/
13
+ *.py[cod]
14
+ *$py.class
15
+
16
+ # C extensions
17
+ *.so
18
+
19
+ # Distribution / packaging
20
+ .Python
21
+ build/
22
+ develop-eggs/
23
+ dist/
24
+ downloads/
25
+ eggs/
26
+ .eggs/
27
+ lib/
28
+ lib64/
29
+ parts/
30
+ sdist/
31
+ var/
32
+ wheels/
33
+ share/python-wheels/
34
+ *.egg-info/
35
+ .installed.cfg
36
+ *.egg
37
+ MANIFEST
38
+
39
+ # PyInstaller
40
+ # Usually these files are written by a python script from a template
41
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
42
+ *.manifest
43
+ *.spec
44
+
45
+ # Installer logs
46
+ pip-log.txt
47
+ pip-delete-this-directory.txt
48
+
49
+ # Unit test / coverage reports
50
+ htmlcov/
51
+ .tox/
52
+ .nox/
53
+ .coverage
54
+ .coverage.*
55
+ .cache
56
+ nosetests.xml
57
+ coverage.xml
58
+ *.cover
59
+ *.py,cover
60
+ .hypothesis/
61
+ .pytest_cache/
62
+ cover/
63
+
64
+ # Translations
65
+ *.mo
66
+ *.pot
67
+
68
+ # Django stuff:
69
+ *.log
70
+ local_settings.py
71
+ db.sqlite3
72
+ db.sqlite3-journal
73
+
74
+ # Flask stuff:
75
+ instance/
76
+ .webassets-cache
77
+
78
+ # Scrapy stuff:
79
+ .scrapy
80
+
81
+ # Sphinx documentation
82
+ docs/_build/
83
+
84
+ # PyBuilder
85
+ .pybuilder/
86
+ target/
87
+
88
+ # Jupyter Notebook
89
+ .ipynb_checkpoints
90
+
91
+ # IPython
92
+ profile_default/
93
+ ipython_config.py
94
+
95
+ # pyenv
96
+ # For a library or package, you might want to ignore these files since the code is
97
+ # intended to run in multiple environments; otherwise, check them in:
98
+ # .python-version
99
+
100
+ # pipenv
101
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
102
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
103
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
104
+ # install all needed dependencies.
105
+ #Pipfile.lock
106
+
107
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
108
+ __pypackages__/
109
+
110
+ # Celery stuff
111
+ celerybeat-schedule
112
+ celerybeat.pid
113
+
114
+ # SageMath parsed files
115
+ *.sage.py
116
+
117
+ # Environments
118
+ .env
119
+ .venv
120
+ env/
121
+ venv/
122
+ ENV/
123
+ env.bak/
124
+ venv.bak/
125
+
126
+ # Different python version environments
127
+ /env*/
128
+
129
+ # Spyder project settings
130
+ .spyderproject
131
+ .spyproject
132
+
133
+ # Rope project settings
134
+ .ropeproject
135
+
136
+ # mkdocs documentation
137
+ /site
138
+
139
+ # mypy
140
+ .mypy_cache/
141
+ .dmypy.json
142
+ dmypy.json
143
+
144
+ # Pyre type checker
145
+ .pyre/
146
+
147
+ # pytype static type analyzer
148
+ .pytype/
149
+
150
+ # Cython debug symbols
151
+ cython_debug/
152
+
153
+ # Scratch folder
154
+ scratch/
155
+
156
+ # Setuptools-scm version file
157
+ _version.py
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023-2024 David C Ellis
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,24 +1,25 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ducktools-pythonfinder
3
- Version: 0.1.0
3
+ Version: 0.2.0
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
7
7
  Classifier: Development Status :: 3 - Alpha
8
+ Classifier: Programming Language :: Python :: 3.8
9
+ Classifier: Programming Language :: Python :: 3.9
8
10
  Classifier: Programming Language :: Python :: 3.10
9
11
  Classifier: Programming Language :: Python :: 3.11
10
12
  Classifier: Programming Language :: Python :: 3.12
11
13
  Classifier: Programming Language :: Python :: 3.13
12
- Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)
14
+ Classifier: License :: OSI Approved :: MIT License
13
15
  Classifier: Operating System :: MacOS
14
16
  Classifier: Operating System :: Microsoft :: Windows :: Windows 10
15
17
  Classifier: Operating System :: POSIX :: Linux
16
- Requires-Python: >=3.10
18
+ Requires-Python: >=3.8
17
19
  Description-Content-Type: text/markdown
18
- License-File: COPYING
19
- License-File: COPYING.LESSER
20
+ License-File: LICENSE
20
21
  Requires-Dist: ducktools-lazyimporter
21
- Requires-Dist: prefab-classes
22
+ Requires-Dist: ducktools-classbuilder
22
23
  Provides-Extra: testing
23
24
  Requires-Dist: pytest; extra == "testing"
24
25
  Requires-Dist: pytest-cov; extra == "testing"
@@ -28,7 +29,7 @@ Requires-Dist: pyfakefs; extra == "testing"
28
29
 
29
30
  Find python installs on Linux, Windows and MacOS.
30
31
 
31
- Requires Python >= 3.10 (but will discover older Python installs)
32
+ Requires Python >= 3.8 (but will discover older Python installs)
32
33
 
33
34
  ## Quick usage ##
34
35
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Find python installs on Linux, Windows and MacOS.
4
4
 
5
- Requires Python >= 3.10 (but will discover older Python installs)
5
+ Requires Python >= 3.8 (but will discover older Python installs)
6
6
 
7
7
  ## Quick usage ##
8
8
 
@@ -1,7 +1,7 @@
1
1
  [build-system]
2
2
  requires = [
3
- "setuptools>=61.0",
4
- "wheel",
3
+ "setuptools>=64",
4
+ "setuptools-scm>=8",
5
5
  ]
6
6
  build-backend = "setuptools.build_meta"
7
7
 
@@ -12,18 +12,20 @@ authors = [
12
12
  { name = "David C Ellis" },
13
13
  ]
14
14
  readme = "README.md"
15
- requires-python = ">=3.10"
15
+ requires-python = ">=3.8"
16
16
  dependencies = [
17
17
  "ducktools-lazyimporter",
18
- "prefab-classes",
18
+ "ducktools-classbuilder",
19
19
  ]
20
20
  classifiers = [
21
21
  "Development Status :: 3 - Alpha",
22
+ "Programming Language :: Python :: 3.8",
23
+ "Programming Language :: Python :: 3.9",
22
24
  "Programming Language :: Python :: 3.10",
23
25
  "Programming Language :: Python :: 3.11",
24
26
  "Programming Language :: Python :: 3.12",
25
27
  "Programming Language :: Python :: 3.13",
26
- "License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)",
28
+ "License :: OSI Approved :: MIT License",
27
29
  "Operating System :: MacOS",
28
30
  "Operating System :: Microsoft :: Windows :: Windows 10",
29
31
  "Operating System :: POSIX :: Linux",
@@ -39,8 +41,8 @@ testing = ["pytest", "pytest-cov", "pyfakefs"]
39
41
  [tool.setuptools.packages.find]
40
42
  where = ["src"]
41
43
 
42
- [tool.setuptools.dynamic]
43
- version = { attr = "ducktools.pythonfinder.__version__" }
44
+ [tool.setuptools_scm]
45
+ version_file = "src/ducktools/pythonfinder/_version.py"
44
46
 
45
47
  [tool.pytest.ini_options]
46
48
  addopts = "--cov=src/ --cov-report=term-missing --cov-report=xml:coverage.xml"
@@ -14,6 +14,12 @@
14
14
  # You should have received a copy of the GNU Lesser General Public License
15
15
  # along with this program. If not, see <https://www.gnu.org/licenses/>.
16
16
 
17
- """Currently just copied from linux"""
17
+ """
18
+ Get the PythonInstall for the python version running
19
+ """
18
20
 
19
- from ..linux import get_python_installs, get_path_pythons, get_pyenv_pythons
21
+ import sys
22
+
23
+ from ducktools.pythonfinder.shared import get_install_details
24
+
25
+ print(get_install_details(sys.executable))
@@ -0,0 +1,8 @@
1
+ import os.path
2
+ from ducktools.pythonfinder import get_python_installs
3
+
4
+ user_path = os.path.expanduser("~")
5
+
6
+ for env in get_python_installs():
7
+ env.executable = env.executable.replace(user_path, "~")
8
+ print(env)
@@ -0,0 +1,46 @@
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
+
24
+ # Find platform python versions
25
+
26
+ __all__ = [
27
+ "get_python_installs",
28
+ "list_python_installs",
29
+ "PythonInstall",
30
+ ]
31
+
32
+ import sys
33
+ from ._version import __version__
34
+ from .shared import PythonInstall
35
+
36
+
37
+ if sys.platform == "win32":
38
+ from .win32 import get_python_installs
39
+ elif sys.platform == "darwin":
40
+ from .darwin import get_python_installs
41
+ else:
42
+ from .linux import get_python_installs
43
+
44
+
45
+ def list_python_installs():
46
+ return sorted(get_python_installs(), reverse=True, key=lambda x: x.version)
@@ -1,18 +1,25 @@
1
1
  # ducktools-pythonfinder
2
- # Copyright (C) 2024 David C Ellis
2
+ # MIT License
3
3
  #
4
- # This program is free software: you can redistribute it and/or modify
5
- # it under the terms of the GNU Lesser General Public License as published by
6
- # the Free Software Foundation, either version 3 of the License, or
7
- # (at your option) any later version.
4
+ # Copyright (c) 2023-2024 David C Ellis
8
5
  #
9
- # This program is distributed in the hope that it will be useful,
10
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- # GNU Lesser General Public License for more details.
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:
13
12
  #
14
- # You should have received a copy of the GNU Lesser General Public License
15
- # along with this program. If not, see <https://www.gnu.org/licenses/>.
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.
16
23
 
17
24
 
18
25
  import sys
@@ -0,0 +1,16 @@
1
+ # file generated by setuptools_scm
2
+ # don't change, don't track in version control
3
+ TYPE_CHECKING = False
4
+ if TYPE_CHECKING:
5
+ from typing import Tuple, Union
6
+ VERSION_TUPLE = Tuple[Union[int, str], ...]
7
+ else:
8
+ VERSION_TUPLE = object
9
+
10
+ version: str
11
+ __version__: str
12
+ __version_tuple__: VERSION_TUPLE
13
+ version_tuple: VERSION_TUPLE
14
+
15
+ __version__ = version = '0.2.0'
16
+ __version_tuple__ = version_tuple = (0, 2, 0)
@@ -0,0 +1,26 @@
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
+
24
+ """Currently just copied from linux"""
25
+
26
+ from ..linux import get_python_installs, get_path_pythons, get_pyenv_pythons
@@ -0,0 +1,65 @@
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
+
24
+ """
25
+ Get the details from a python install as JSON
26
+ """
27
+ import sys
28
+
29
+
30
+ def get_details():
31
+ try:
32
+ implementation = sys.implementation.name
33
+ except AttributeError: # pragma: no cover
34
+ # Probably Python 2
35
+ import platform
36
+
37
+ implementation = platform.python_implementation().lower()
38
+ metadata = {}
39
+ else:
40
+ if implementation != "cpython": # pragma: no cover
41
+ metadata = {"{}_version".format(implementation): sys.implementation.version}
42
+ else:
43
+ metadata = {}
44
+
45
+ install = dict(
46
+ version=list(sys.version_info),
47
+ executable=sys.executable,
48
+ architecture="64bit" if (sys.maxsize > 2**32) else "32bit",
49
+ implementation=implementation,
50
+ metadata=metadata,
51
+ )
52
+
53
+ return install
54
+
55
+
56
+ def main():
57
+ import json
58
+
59
+ install = get_details()
60
+
61
+ sys.stdout.write(json.dumps(install))
62
+
63
+
64
+ if __name__ == "__main__": # pragma: no cover
65
+ main()