Skip to content

Commit 94af05f

Browse files
committed
bump version, merge branch 'devel'
2 parents c3fcafe + 69d6383 commit 94af05f

File tree

6 files changed

+89
-3
lines changed

6 files changed

+89
-3
lines changed

.github/workflows/comment-bot.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Comment Bot
2+
on:
3+
issue_comment:
4+
types: [created, edited]
5+
pull_request_review_comment:
6+
types: [created, edited]
7+
8+
jobs:
9+
tag:
10+
if: startsWith(github.event.comment.body, '/tag ')
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: React Seen
15+
uses: actions/github-script@v2
16+
with:
17+
script: |
18+
post = context.eventName === 'issue_comment' ? github.reactions.createForIssueComment : github.reactions.createForPullRequestReviewComment
19+
post({
20+
owner: context.repo.owner,
21+
repo: context.repo.repo,
22+
comment_id: context.payload.comment.id,
23+
content: "eyes",
24+
})
25+
- name: Tag Commit
26+
run: |
27+
git config user.name tag-bot
28+
git config user.email [email protected]
29+
git tag $(echo "$BODY" | awk '{print $2" "$3}')
30+
git push --tags
31+
env:
32+
BODY: ${{ github.event.comment.body }}
33+
- name: React Success
34+
uses: actions/github-script@v2
35+
with:
36+
script: |
37+
post = context.eventName === 'issue_comment' ? github.reactions.createForIssueComment : github.reactions.createForPullRequestReviewComment
38+
post({
39+
owner: context.repo.owner,
40+
repo: context.repo.repo,
41+
comment_id: context.payload.comment.id,
42+
content: "rocket",
43+
})
44+
always:
45+
runs-on: ubuntu-latest
46+
steps:
47+
- run: echo prevent failure when other jobs are skipped

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# Packages
44
shtab.egg-info/
5+
/.eggs/
56
/build/
67
/dist/
78

CONTRIBUTING.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,13 @@ string snippets without clashing between python's `str.format` and shell
3535
parameter expansion.
3636

3737
The generated shell code itself is also meant to be readable.
38+
39+
## Releases
40+
41+
Tests and deployment are handled automatically by continuous integration. Simply
42+
tag a commit `v{major}.{minor}.{patch}` and wait for a draft release to appear
43+
at <https://github.com/iterative/shtab/releases>. Tidy up the draft's
44+
description before publishing it.
45+
46+
Note that tagging a release is possible by commenting `/tag vM.m.p HASH` in an
47+
issue or PR.

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
__author__ = "Casper da Costa-Luis <[email protected]>"
1313
__licence__ = "Apache-2.0"
14-
__version__ = "1.0.4"
1514
src_dir = os.path.abspath(os.path.dirname(__file__))
1615

1716
# Execute Makefile commands if specified
@@ -31,7 +30,8 @@
3130
requirements_dev = fd.readlines()
3231
setup(
3332
name="shtab",
34-
version=__version__,
33+
use_scm_version=True,
34+
setup_requires=["setuptools_scm"],
3535
description="Automatically generate shell tab completion scripts"
3636
" for python CLI apps",
3737
long_description=README_rst,

shtab/__init__.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,31 @@
1414
)
1515
from functools import total_ordering
1616

17+
18+
def get_version_dist(name=__name__):
19+
from pkg_resources import DistributionNotFound, get_distribution
20+
21+
try:
22+
return get_distribution(name).version
23+
except DistributionNotFound:
24+
return "UNKNOWN"
25+
26+
27+
try:
28+
from setuptools_scm import get_version
29+
except ImportError:
30+
from os import path
31+
32+
ROOT = path.abspath(path.dirname(path.dirname(__file__)))
33+
if path.exists(path.join(ROOT, ".git")):
34+
__version__ = "UNKNOWN - please install setuptools_scm"
35+
else:
36+
__version__ = get_version_dist()
37+
else:
38+
try:
39+
__version__ = get_version(root="..", relative_to=__file__)
40+
except LookupError:
41+
__version__ = get_version_dist()
1742
__all__ = ["Optional", "Required", "Choice", "complete"]
1843
log = logging.getLogger(__name__)
1944

shtab/main.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import logging
55
from importlib import import_module
66

7-
from . import complete
7+
from . import __version__, complete
88

99
log = logging.getLogger(__name__)
1010

@@ -14,6 +14,9 @@ def get_main_parser():
1414
parser.add_argument(
1515
"parser", help="importable parser (or fuction returning parser)"
1616
)
17+
parser.add_argument(
18+
"--version", action="version", version="%(prog)s " + __version__
19+
)
1720
parser.add_argument(
1821
"-s", "--shell", default="bash", choices=["bash", "zsh"]
1922
)

0 commit comments

Comments
 (0)