Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1da8be3

Browse files
committed
pyproject: Add g script name
1 parent 462614a commit 1da8be3

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

‎g.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env python
2+
3+
import pathlib
4+
import subprocess
5+
import sys
6+
7+
vcspath_registry = {".git": "git", ".svn": "svn", ".hg": "hg"}
8+
9+
10+
def find_repo_type(path):
11+
for path in list(pathlib.Path(path).parents) + [pathlib.Path(path)]:
12+
for p in path.iterdir():
13+
if p.is_dir():
14+
if p.name in vcspath_registry:
15+
return vcspath_registry[p.name]
16+
17+
18+
vcs_bin = find_repo_type(pathlib.Path.cwd())
19+
20+
21+
def run(cmd=vcs_bin, cmd_args=sys.argv[1:], *args, **kwargs):
22+
proc = subprocess.Popen([cmd, *cmd_args])
23+
proc.communicate()

‎pyproject.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ classifiers = [
2121
"Topic :: System :: Shells"
2222
]
2323
packages = [
24-
{ include = "vcspull" }
24+
{ include = "vcspull" },
2525
]
2626
include = [
27-
{ path = "tests", format = "sdist" }
27+
{ path = "tests", format = "sdist" },
28+
{ path = "g.py" }
2829
]
2930
readme = 'README.md'
3031
keywords = ["vcspull", "git", "vcs", "json", "yaml"]
@@ -39,6 +40,7 @@ Changes = "https://github.com/vcs-python/vcspull/blob/master/CHANGES"
3940

4041
[tool.poetry.scripts]
4142
vcspull = 'vcspull:cli.cli'
43+
g = 'g:run'
4244

4345
[tool.poetry.dependencies]
4446
python = "^3.7"
@@ -80,5 +82,5 @@ format = ["black", "isort"]
8082
lint = ["flake8"]
8183

8284
[build-system]
83-
requires = ["poetry_core>=1.0.0"]
85+
requires = ["poetry_core>=1.0.0", "setuptools>60"]
8486
build-backend = "poetry.core.masonry.api"

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /