Skip to content

Commit 3741479

Browse files
authored
Merge pull request #1 from qtc-de/develop
Make kutil a pip package
2 parents 6b12be6 + 3f0baef commit 3741479

16 files changed

Lines changed: 1417 additions & 735 deletions

File tree

.github/workflows/develop.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: develop Python CI
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
pull_request:
8+
branches:
9+
- develop
10+
11+
jobs:
12+
build:
13+
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
python-version: [3.7, 3.8]
18+
19+
steps:
20+
- uses: actions/checkout@v2
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v2
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
- name: Cache pip
26+
uses: actions/cache@v2
27+
with:
28+
path: ~/.cache/pip
29+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
30+
restore-keys: |
31+
${{ runner.os }}-pip-
32+
- name: Install dependencies
33+
run: |
34+
python -m pip install --upgrade pip
35+
pip install flake8 pytest
36+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
37+
- name: Lint with flake8
38+
run: |
39+
# stop the build if there are Python syntax errors or undefined names
40+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
41+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
42+
flake8 . --count --exit-zero --max-complexity=11 --max-line-length=127 --statistics
43+
- name: Test with pytest
44+
run: |
45+
pytest

.github/workflows/master.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: master Python CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
jobs:
12+
build:
13+
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
python-version: [3.7, 3.8]
18+
19+
steps:
20+
- uses: actions/checkout@v2
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v2
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
- name: Cache pip
26+
uses: actions/cache@v2
27+
with:
28+
path: ~/.cache/pip
29+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
30+
restore-keys: |
31+
${{ runner.os }}-pip-
32+
- name: Install dependencies
33+
run: |
34+
python -m pip install --upgrade pip
35+
pip install flake8 pytest
36+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
37+
- name: Lint with flake8
38+
run: |
39+
# stop the build if there are Python syntax errors or undefined names
40+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
41+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
42+
flake8 . --count --exit-zero --max-complexity=11 --max-line-length=127 --statistics
43+
- name: Test with pytest
44+
run: |
45+
pytest

.github/workflows/pypi.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Upload Python Package
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
deploy:
9+
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Set up Python
15+
uses: actions/setup-python@v2
16+
with:
17+
python-version: '3.x'
18+
- name: Install dependencies
19+
run: |
20+
python -m pip install --upgrade pip
21+
pip install setuptools wheel twine
22+
- name: Build and publish
23+
env:
24+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
25+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
26+
run: |
27+
python setup.py sdist
28+
twine upload dist/*

README.md

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
It supports different operations like merging, splitting and modifying ticket caches.
77
A detailed list of all supported operations can be found in the [operations section](#supported-operations).
88

9+
![](https://github.com/qtc-de/kutil/workflows/master%20Python%20CI/badge.svg?branch=master)
10+
![](https://github.com/qtc-de/kutil/workflows/develop%20Python%20CI/badge.svg?branch=develop)
11+
912

1013
### Table of Contents
1114

@@ -38,25 +41,32 @@ A detailed list of all supported operations can be found in the [operations sect
3841

3942
----
4043

41-
*kutil* is just an executable python script, not a library. Just install the required
42-
dependencies and copy the script to a folder within your ``$PATH``.
43-
On *Kali Linux*, all dependencies should be preinstalled and *kutil* should work out of the box.
44+
*kutil* can be build and installed as a *pip* package. The following
45+
command installs *kutil* for your current user profile:
46+
47+
```console
48+
$ pip3 install kutil
49+
```
50+
51+
You can also build *kutil* from source and install it directly by using
52+
the following commands:
4453

4554
```console
4655
$ git clone https://github.com/qtc-de/kutil
47-
$ pip3 install -r kutil/requirements.txt
48-
$ ln -s $(realpath kutil/kutil.py) ~/.local/bin/kutil
56+
$ cd kutil
57+
$ pip3 install -r requirements.txt
58+
$ python3 setup.py sdist
59+
$ pip3 install dist/*
4960
```
5061

51-
*kutil* supports autocompletion for *bash* and the corresponding completion script can be found
52-
inside the [bash_completion.d](./bash_completion.d) folder. The script assumes that the
53-
[bash-completion](https://github.com/scop/bash-completion) package is installed and that
54-
my [completion-helpers](https://github.com/qtc-de/completion-helpers) functions are available.
55-
If you setup both projects, you can just copy the completion script inside your local
56-
``~/.bash_completion.d`` folder:
62+
Additionally, *kutil* ships a [bash-completion](./kutil/resources/bash_completion.d/kutil) script.
63+
The completion script is installed automatically, but relies on the [completion-helpers](https://github.com/qtc-de/completion-helpers)
64+
package. If *completion-helpers* is already installed, autocompletion for *kutil* should
65+
work after installing the pip package. Otherwise, you may need to copy the completion
66+
script manually:
5767

5868
```console
59-
$ ln -s $(realpath kutil/bash_completion.d/kutil) ~/bash_completion.d/kutil
69+
$ cp kutil/resources/bash_completion.d/kutil ~/.bash_completion.d
6070
```
6171

6272

0 commit comments

Comments
 (0)