dotslash 0.5.8__py3-none-manylinux_2_28_aarch64.whl
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.
- dotslash/__init__.py +36 -0
- dotslash/__main__.py +16 -0
- dotslash/_locate.py +39 -0
- dotslash/py.typed +0 -0
- dotslash-0.5.8.data/scripts/dotslash +0 -0
- dotslash-0.5.8.dist-info/METADATA +61 -0
- dotslash-0.5.8.dist-info/RECORD +8 -0
- dotslash-0.5.8.dist-info/WHEEL +4 -0
dotslash/__init__.py
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
|
4
|
+
def locate() -> str:
|
5
|
+
"""
|
6
|
+
Returns:
|
7
|
+
The path to the DotSlash binary that was installed by this package.
|
8
|
+
"""
|
9
|
+
import os
|
10
|
+
import sys
|
11
|
+
import sysconfig
|
12
|
+
|
13
|
+
from dotslash._locate import _search_paths
|
14
|
+
|
15
|
+
if extension := sysconfig.get_config_var("EXE"):
|
16
|
+
binary_name = f"dotslash{extension}"
|
17
|
+
elif sys.platform == "win32":
|
18
|
+
binary_name = "dotslash.exe"
|
19
|
+
else:
|
20
|
+
binary_name = "dotslash"
|
21
|
+
|
22
|
+
# Map of normalized paths to the actual path
|
23
|
+
seen_paths: dict[str, str] = {}
|
24
|
+
for search_path in _search_paths():
|
25
|
+
normalized_path = os.path.normcase(search_path)
|
26
|
+
if normalized_path in seen_paths:
|
27
|
+
continue
|
28
|
+
|
29
|
+
seen_paths[normalized_path] = search_path
|
30
|
+
binary_path = os.path.join(search_path, binary_name)
|
31
|
+
if os.path.isfile(binary_path):
|
32
|
+
return binary_path
|
33
|
+
|
34
|
+
search_paths = "\n".join(f"- {search_path}" for search_path in seen_paths.values())
|
35
|
+
msg = f"The `{binary_name}` binary was not found in any of the following paths:\n{search_paths}"
|
36
|
+
raise FileNotFoundError(msg)
|
dotslash/__main__.py
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
if __name__ == "__main__":
|
2
|
+
import sys
|
3
|
+
|
4
|
+
from dotslash import locate
|
5
|
+
|
6
|
+
dotslash = locate()
|
7
|
+
|
8
|
+
if sys.platform == "win32":
|
9
|
+
import subprocess
|
10
|
+
|
11
|
+
process = subprocess.run([dotslash, *sys.argv[1:]])
|
12
|
+
sys.exit(process.returncode)
|
13
|
+
else:
|
14
|
+
import os
|
15
|
+
|
16
|
+
os.execvp(dotslash, [dotslash, *sys.argv[1:]])
|
dotslash/_locate.py
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
import os
|
4
|
+
import sys
|
5
|
+
import sysconfig
|
6
|
+
|
7
|
+
|
8
|
+
def _search_paths():
|
9
|
+
# The scripts directory for the current Python installation
|
10
|
+
yield sysconfig.get_path("scripts")
|
11
|
+
|
12
|
+
# The scripts directory for the base prefix if in a virtual environment
|
13
|
+
yield sysconfig.get_path("scripts", vars={"base": sys.base_prefix, "platbase": sys.base_exec_prefix})
|
14
|
+
|
15
|
+
module_dir = os.path.dirname(os.path.abspath(__file__))
|
16
|
+
package_parent, package_name = os.path.split(module_dir)
|
17
|
+
if package_name == "dotslash":
|
18
|
+
# Above the package root e.g. when running `pip install --prefix` or `uv run --with`
|
19
|
+
# Windows: <prefix>\Lib\site-packages\dotslash
|
20
|
+
# macOS: <prefix>/lib/pythonX.Y/site-packages/dotslash
|
21
|
+
# Linux:
|
22
|
+
# <prefix>/lib/pythonX.Y/site-packages/dotslash
|
23
|
+
# <prefix>/lib/pythonX.Y/dist-packages/dotslash (Debian-based distributions)
|
24
|
+
head, tail = os.path.split(package_parent)
|
25
|
+
if tail.endswith("-packages"):
|
26
|
+
head, tail = os.path.split(head)
|
27
|
+
if sys.platform == "win32":
|
28
|
+
if tail == "Lib":
|
29
|
+
yield os.path.join(head, "Scripts")
|
30
|
+
elif tail.startswith("python"):
|
31
|
+
head, tail = os.path.split(head)
|
32
|
+
if tail == sys.platlibdir:
|
33
|
+
yield os.path.join(head, "bin")
|
34
|
+
else:
|
35
|
+
# Adjacent to the package root e.g. when using the `--target` option of pip-like installers
|
36
|
+
yield os.path.join(package_parent, "bin")
|
37
|
+
|
38
|
+
# The scripts directory for user installations
|
39
|
+
yield sysconfig.get_path("scripts", scheme=sysconfig.get_preferred_scheme("user"))
|
dotslash/py.typed
ADDED
File without changes
|
Binary file
|
@@ -0,0 +1,61 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: dotslash
|
3
|
+
Version: 0.5.8
|
4
|
+
Summary: Command-line tool to facilitate fetching an executable, caching it, and then running it.
|
5
|
+
Project-URL: Homepage, https://dotslash-cli.com
|
6
|
+
Project-URL: Tracker, https://github.com/facebook/dotslash/issues
|
7
|
+
Project-URL: Source, https://github.com/facebook/dotslash
|
8
|
+
Author-email: Ofek Lev <oss@ofek.dev>
|
9
|
+
License-Expression: MIT OR Apache-2.0
|
10
|
+
Keywords: dotslash
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
12
|
+
Classifier: Intended Audience :: Developers
|
13
|
+
Classifier: Natural Language :: English
|
14
|
+
Classifier: Operating System :: OS Independent
|
15
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
16
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
17
|
+
Requires-Python: >=3.10
|
18
|
+
Description-Content-Type: text/markdown
|
19
|
+
|
20
|
+
# DotSlash: simplified executable deployment
|
21
|
+
|
22
|
+
[](https://github.com/ofek/dotslash/actions/workflows/build.yml)
|
23
|
+
[](https://github.com/ofek/dotslash/actions/workflows/test.yml)
|
24
|
+
[](https://pypi.org/project/dotslash/)
|
25
|
+
[](https://pypi.org/project/dotslash/)
|
26
|
+
[](https://github.com/pypa/hatch)
|
27
|
+
[](https://github.com/astral-sh/ruff)
|
28
|
+
|
29
|
+
-----
|
30
|
+
|
31
|
+
[DotSlash](https://dotslash-cli.com/docs/) (`dotslash`) is a command-line tool that lets you represent a set of platform-specific, heavyweight executables with an equivalent small, easy-to-read text file. In turn, this makes it efficient to store executables in source control without hurting repository size. This paves the way for checking build toolchains and other tools directly into the repo, reducing dependencies on the host environment and thereby facilitating reproducible builds.
|
32
|
+
|
33
|
+
The `dotslash` package allows you to use DotSlash in your Python projects without having to install DotSlash globally.
|
34
|
+
|
35
|
+
***Table of Contents***
|
36
|
+
|
37
|
+
- [Using as a library](#using-as-a-library)
|
38
|
+
- [Using as a command-line tool](#using-as-a-command-line-tool)
|
39
|
+
- [License](#license)
|
40
|
+
|
41
|
+
## Using as a library
|
42
|
+
|
43
|
+
The `dotslash.locate` function returns the path to the DotSlash binary that was installed by this package.
|
44
|
+
|
45
|
+
```pycon
|
46
|
+
>>> import dotslash
|
47
|
+
>>> dotslash.locate()
|
48
|
+
'/root/.local/bin/dotslash'
|
49
|
+
```
|
50
|
+
|
51
|
+
## Using as a command-line tool
|
52
|
+
|
53
|
+
The installed DotSlash binary can be invoked directly by running the `dotslash` module as a script.
|
54
|
+
|
55
|
+
```
|
56
|
+
python -m dotslash path/to/dotslash-file.json
|
57
|
+
```
|
58
|
+
|
59
|
+
## License
|
60
|
+
|
61
|
+
DotSlash is licensed under both the MIT license and Apache-2.0 license; the exact terms can be found in the [LICENSE-MIT]() and LICENSE-APACHE files, respectively.
|
@@ -0,0 +1,8 @@
|
|
1
|
+
dotslash/__init__.py,sha256=RwrwUD4V3uVIR-l74szVivnihV7ELJtYQcbmirt6vkg,1125
|
2
|
+
dotslash/__main__.py,sha256=yPbDw8nAL_B_R0E8xR9B_U_NerYlGuyKtSK8OnXzmFs,341
|
3
|
+
dotslash/_locate.py,sha256=vsI1dQn6aY6qvJExq6iA0sKJuy66t3IDSmrA-VYjf4o,1678
|
4
|
+
dotslash/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
|
+
dotslash-0.5.8.data/scripts/dotslash,sha256=jwG2IApcn4WnXj45C2gtOYaVWYEEMmzSXygg71zxjvY,1424400
|
6
|
+
dotslash-0.5.8.dist-info/METADATA,sha256=b8KIjQMSgIQBeQA2C1N9LuviX5WLX6QFG73hRZZW8SA,3087
|
7
|
+
dotslash-0.5.8.dist-info/WHEEL,sha256=4PUJJvdHC6Ti__CUgDXdGTWUZ7Fk-1E6rWEMoqVjnYI,106
|
8
|
+
dotslash-0.5.8.dist-info/RECORD,,
|