omdev 0.0.0.dev44__py3-none-any.whl → 0.0.0.dev46__py3-none-any.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.
Potentially problematic release.
This version of omdev might be problematic. Click here for more details.
- omdev/cli/install.py +5 -1
- omdev/cli/main.py +2 -2
- omdev/cli/managers.py +38 -20
- omdev/tools/piptools.py +1 -1
- {omdev-0.0.0.dev44.dist-info → omdev-0.0.0.dev46.dist-info}/METADATA +2 -2
- {omdev-0.0.0.dev44.dist-info → omdev-0.0.0.dev46.dist-info}/RECORD +10 -10
- {omdev-0.0.0.dev44.dist-info → omdev-0.0.0.dev46.dist-info}/LICENSE +0 -0
- {omdev-0.0.0.dev44.dist-info → omdev-0.0.0.dev46.dist-info}/WHEEL +0 -0
- {omdev-0.0.0.dev44.dist-info → omdev-0.0.0.dev46.dist-info}/entry_points.txt +0 -0
- {omdev-0.0.0.dev44.dist-info → omdev-0.0.0.dev46.dist-info}/top_level.txt +0 -0
omdev/cli/install.py
CHANGED
|
@@ -86,6 +86,7 @@ class UvxInstallManager(InstallManager):
|
|
|
86
86
|
'--from', opts.cli_pkg,
|
|
87
87
|
'om',
|
|
88
88
|
'_post_install',
|
|
89
|
+
opts.cli_pkg,
|
|
89
90
|
])
|
|
90
91
|
|
|
91
92
|
|
|
@@ -120,11 +121,12 @@ class PipxInstallManager(InstallManager):
|
|
|
120
121
|
|
|
121
122
|
dct = self._list_installed()
|
|
122
123
|
|
|
123
|
-
exe = dct[opts.cli_pkg]['metadata']['main_package']['app_paths'][0]['__Path__']
|
|
124
|
+
exe = dct['venvs'][opts.cli_pkg]['metadata']['main_package']['app_paths'][0]['__Path__']
|
|
124
125
|
|
|
125
126
|
subprocess.check_call([
|
|
126
127
|
exe,
|
|
127
128
|
'_post_install',
|
|
129
|
+
opts.cli_pkg,
|
|
128
130
|
])
|
|
129
131
|
|
|
130
132
|
|
|
@@ -148,6 +150,8 @@ def _main() -> None:
|
|
|
148
150
|
if not (cli := args.cli):
|
|
149
151
|
raise ValueError(f'Must specify cli')
|
|
150
152
|
|
|
153
|
+
cli = cli.lower().replace('_', '-')
|
|
154
|
+
|
|
151
155
|
if not (py := args.py):
|
|
152
156
|
raise ValueError(f'Must specify py')
|
|
153
157
|
|
omdev/cli/main.py
CHANGED
omdev/cli/managers.py
CHANGED
|
@@ -7,44 +7,62 @@ import sys
|
|
|
7
7
|
##
|
|
8
8
|
|
|
9
9
|
|
|
10
|
+
def _normalize_pkg_name(s: str) -> str:
|
|
11
|
+
return s.lower().replace('_', '-')
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
##
|
|
15
|
+
|
|
16
|
+
|
|
10
17
|
class ManagerType(enum.Enum):
|
|
11
18
|
UVX = 'uvx'
|
|
12
19
|
PIPX = 'pipx'
|
|
13
20
|
|
|
14
21
|
|
|
15
|
-
def
|
|
22
|
+
def detect_install_manager(cli_pkg: str) -> ManagerType | None:
|
|
16
23
|
if os.path.isfile(fp := os.path.join(sys.prefix, 'uv-receipt.toml')):
|
|
24
|
+
import tomllib
|
|
25
|
+
|
|
17
26
|
with open(fp) as f:
|
|
18
|
-
|
|
19
|
-
return ManagerType.UVX
|
|
27
|
+
dct = tomllib.loads(f.read())
|
|
20
28
|
|
|
21
|
-
|
|
22
|
-
|
|
29
|
+
reqs = dct.get('tool', {}).get('requirements')
|
|
30
|
+
main_pkg = _normalize_pkg_name(reqs[0].get('name', ''))
|
|
31
|
+
if reqs and main_pkg == cli_pkg:
|
|
32
|
+
return ManagerType.UVX
|
|
23
33
|
|
|
24
|
-
|
|
34
|
+
if os.path.isfile(fp := os.path.join(sys.prefix, 'pipx_metadata.json')):
|
|
35
|
+
import json
|
|
25
36
|
|
|
37
|
+
with open(fp) as f:
|
|
38
|
+
dct = json.loads(f.read())
|
|
26
39
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
ret = globals()['_DETECTED_MANAGER_TYPE'] = _detect_install_manager()
|
|
33
|
-
return ret
|
|
40
|
+
main_pkg = _normalize_pkg_name(dct.get('main_package', {}).get('package_or_url', ''))
|
|
41
|
+
if main_pkg == cli_pkg:
|
|
42
|
+
return ManagerType.PIPX
|
|
43
|
+
|
|
44
|
+
return None
|
|
34
45
|
|
|
35
46
|
|
|
36
47
|
##
|
|
48
|
+
# Python is insistent in prepending sys.path with an empty string (translating to the current working directory),
|
|
49
|
+
# which leads to problems when using the cli in directories containing python packages (such as within this very
|
|
50
|
+
# source tree). This can't be done in cli main as the code frequently spawns other sys.executable processes which
|
|
51
|
+
# wouldn't know to do that, so a .pth file hack is used. Cleaning sys.path solely there is also insufficient as that
|
|
52
|
+
# code runs before the problematic empty string is added, so a sys.meta_path hook is prepended.
|
|
53
|
+
#
|
|
54
|
+
# See:
|
|
55
|
+
# https://github.com/python/cpython/blob/da1e5526aee674bb33c17a498aa3781587b9850c/Python/sysmodule.c#L3939
|
|
37
56
|
|
|
38
57
|
|
|
39
|
-
def
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
sys.path.insert(0, sp)
|
|
58
|
+
def _remove_empty_from_sys_path() -> None:
|
|
59
|
+
while '' in sys.path:
|
|
60
|
+
sys.path.remove('')
|
|
43
61
|
|
|
44
62
|
|
|
45
63
|
class _PathHackMetaFinder:
|
|
46
64
|
def find_spec(self, fullname, path, target=None):
|
|
47
|
-
|
|
65
|
+
_remove_empty_from_sys_path()
|
|
48
66
|
return None # noqa
|
|
49
67
|
|
|
50
68
|
|
|
@@ -70,8 +88,8 @@ def _install_path_hack_file() -> None:
|
|
|
70
88
|
##
|
|
71
89
|
|
|
72
90
|
|
|
73
|
-
def setup_install_manager() -> None:
|
|
74
|
-
if detect_install_manager() is None:
|
|
91
|
+
def setup_install_manager(cli_pkg: str) -> None:
|
|
92
|
+
if detect_install_manager(cli_pkg) is None:
|
|
75
93
|
return
|
|
76
94
|
|
|
77
95
|
_install_path_hack_file()
|
omdev/tools/piptools.py
CHANGED
|
@@ -66,7 +66,7 @@ class Cli(ap.Cli):
|
|
|
66
66
|
dist_cn = canonicalize_name(dist.metadata['Name'], validate=True)
|
|
67
67
|
if dist_cn in dists:
|
|
68
68
|
# raise NameError(dist_cn)
|
|
69
|
-
print(f'!! duplicate dist: {dist_cn}', file=sys.stderr)
|
|
69
|
+
# print(f'!! duplicate dist: {dist_cn}', file=sys.stderr)
|
|
70
70
|
continue
|
|
71
71
|
|
|
72
72
|
dists.add(dist_cn)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: omdev
|
|
3
|
-
Version: 0.0.0.
|
|
3
|
+
Version: 0.0.0.dev46
|
|
4
4
|
Summary: omdev
|
|
5
5
|
Author: wrmsr
|
|
6
6
|
License: BSD-3-Clause
|
|
@@ -12,7 +12,7 @@ Classifier: Operating System :: OS Independent
|
|
|
12
12
|
Classifier: Operating System :: POSIX
|
|
13
13
|
Requires-Python: ~=3.12
|
|
14
14
|
License-File: LICENSE
|
|
15
|
-
Requires-Dist: omlish ==0.0.0.
|
|
15
|
+
Requires-Dist: omlish ==0.0.0.dev46
|
|
16
16
|
Provides-Extra: all
|
|
17
17
|
Requires-Dist: pycparser ~=2.22 ; extra == 'all'
|
|
18
18
|
Requires-Dist: cffi ~=1.17 ; extra == 'all'
|
|
@@ -56,9 +56,9 @@ omdev/cexts/_distutils/compilers/unixccompiler.py,sha256=o1h8QuyupLntv4F21_XjzAZ
|
|
|
56
56
|
omdev/cli/__init__.py,sha256=V_l6VP1SZMlJbO-8CJwSuO9TThOy2S_oaPepNYgIrbE,37
|
|
57
57
|
omdev/cli/__main__.py,sha256=5IeIERm-371fSI5ZvPv8eldAJBwgKwpR0R49pTsILNM,76
|
|
58
58
|
omdev/cli/clicli.py,sha256=NY4MF16007Ri31rUsq868u1V9JYDb_2atBALqjjXJK4,1624
|
|
59
|
-
omdev/cli/install.py,sha256=
|
|
60
|
-
omdev/cli/main.py,sha256=
|
|
61
|
-
omdev/cli/managers.py,sha256=
|
|
59
|
+
omdev/cli/install.py,sha256=SNsCGUeX5IRR9qpkBUCeK7l0nJ_21JsmTYw7Fwu_cs8,4547
|
|
60
|
+
omdev/cli/main.py,sha256=yRbomneGgDPc7cjN8nMpjLmwKqOrKM6U36b5ED9q6T8,2058
|
|
61
|
+
omdev/cli/managers.py,sha256=SbI9XVP2BL8HOjOPyB8pkzB3enKfN6kabgpr9Y_VSW8,2592
|
|
62
62
|
omdev/cli/types.py,sha256=7_Owg0P8C8oOObSuOp6aEYSjkEukVFxTT00SRy1bLHM,250
|
|
63
63
|
omdev/interp/__init__.py,sha256=Y3l4WY4JRi2uLG6kgbGp93fuGfkxkKwZDvhsa0Rwgtk,15
|
|
64
64
|
omdev/interp/__main__.py,sha256=GMCqeGYltgt5dlJzHxY9gqisa8cRkrPfmZYuZnjg4WI,162
|
|
@@ -109,13 +109,13 @@ omdev/tools/__init__.py,sha256=iVJAOQ0viGTQOm0DLX4uZLro-9jOioYJGLg9s0kDx1A,78
|
|
|
109
109
|
omdev/tools/dockertools.py,sha256=x00GV8j1KReMXwxJ641GlcsVwHoWeuzdIKVBp36BqwU,5298
|
|
110
110
|
omdev/tools/gittools.py,sha256=i2WFM2pX5riDJBchFXMmegOCuLSjvTkKC1ltqShSo7E,1773
|
|
111
111
|
omdev/tools/importscan.py,sha256=usF35AjdMZacpe8nfP-wfzxelExT5sEQUORNcBKqr5M,3929
|
|
112
|
-
omdev/tools/piptools.py,sha256
|
|
112
|
+
omdev/tools/piptools.py,sha256=-jR5q3w4sHqntxCLExFCBNIARB788FUsAbJ62PK2sBU,2774
|
|
113
113
|
omdev/tools/proftools.py,sha256=xKSm_yPoCnfsvS3iT9MblDqFMuZmGfI3_koGj8amMyU,145
|
|
114
114
|
omdev/tools/rst.py,sha256=6dWk8QZHoGiLSuBw3TKsXZjjFK6wWBEtPi9krdCLKKg,977
|
|
115
115
|
omdev/tools/sqlrepl.py,sha256=tmFZh80-xsGM62dyQ7_UGLebChrj7IHbIPYBWDJMgVk,5741
|
|
116
|
-
omdev-0.0.0.
|
|
117
|
-
omdev-0.0.0.
|
|
118
|
-
omdev-0.0.0.
|
|
119
|
-
omdev-0.0.0.
|
|
120
|
-
omdev-0.0.0.
|
|
121
|
-
omdev-0.0.0.
|
|
116
|
+
omdev-0.0.0.dev46.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
|
|
117
|
+
omdev-0.0.0.dev46.dist-info/METADATA,sha256=XQ_vi_7osOuVsrnp1mFQAuBGFkT317XYxBLXjWzDZBg,1252
|
|
118
|
+
omdev-0.0.0.dev46.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
119
|
+
omdev-0.0.0.dev46.dist-info/entry_points.txt,sha256=dHLXFmq5D9B8qUyhRtFqTGWGxlbx3t5ejedjrnXNYLU,33
|
|
120
|
+
omdev-0.0.0.dev46.dist-info/top_level.txt,sha256=1nr7j30fEWgLYHW3lGR9pkdHkb7knv1U1ES1XRNVQ6k,6
|
|
121
|
+
omdev-0.0.0.dev46.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|