-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
justfile
97 lines (83 loc) · 3.15 KB
/
justfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
set shell := ["bash", "-c"]
list:
@just --list
PY := "python"
VERSION := `grep "version=" setup.py | egrep -o "[0-9]+\.[0-9]+\.[^\"]+"`
env:
#!/bin/bash
PY_MAYOR="$({{PY}} -c 'import sys; sys.stdout.write(str(sys.version_info[0]))')"
PY_MINOR="$({{PY}} -c 'import sys; sys.stdout.write(str(sys.version_info[1]))')"
PY_VERSION="${PY_MAYOR}${PY_MINOR}"
if [[ "$(python -c 'import sys; sys.stdout.write(str(sys.version_info[0]))')" == "3" ]]; then
[[ -e .env-$HOSTNAME-py${PY_VERSION} ]] || {{PY}} -m venv .env-$HOSTNAME-py${PY_VERSION}
else
[[ -e .env-$HOSTNAME-py${PY_VERSION} ]] || {{PY}} -m virtualenv .env-$HOSTNAME-py${PY_VERSION}
fi
. .env-$HOSTNAME-py${PY_VERSION}/bin/activate
{{PY}} -m pip install -U pip
ci-bootstrap PYTHON_VERSION:
#!/bin/bash
git submodule update --init
if [[ "3."* == "{{PYTHON_VERSION}}" ]]; then
python3 -m pip install --upgrade pip venv
else
python2 -m pip install --upgrade pip virtualenv
fi
clean:
rm -rfv .env-$HOSTNAME-py*
rm -rfv build dist __pycache__ *.egg-info .hypothesis
run COMMAND: env
#!/bin/bash
PY_MAYOR="$({{PY}} -c 'import sys; sys.stdout.write(str(sys.version_info[0]))')"
PY_MINOR="$({{PY}} -c 'import sys; sys.stdout.write(str(sys.version_info[1]))')"
PY_VERSION="${PY_MAYOR}${PY_MINOR}"
. .env-$HOSTNAME-py${PY_VERSION}/bin/activate
{{COMMAND}}
install:
just PY={{PY}} run "python -m pip install -e ."
dev-install:
just PY={{PY}} run "python -m pip install -r requirements-dev.txt"
_test:
#!/usr/bin/env python
import tinyaes
print(tinyaes)
from tinyaes import AES
cipher = AES(b'0123456789ABCDEF')
data = b'ciao'
print("data:", data)
encrypted = cipher.CTR_xcrypt_buffer(data)
print("encrypted:", encrypted)
cipher = AES(b'0123456789ABCDEF')
decrypted = cipher.CTR_xcrypt_buffer(encrypted)
print("decrypted:", decrypted)
_test_null_iv:
#!/usr/bin/env python
import tinyaes
print(tinyaes)
from tinyaes import AES
cipher = AES(b'0123456789ABCDEF', b'\x00'*16)
data = b'ciao'
print("data:", data)
encrypted = cipher.CTR_xcrypt_buffer(data)
print("encrypted:", encrypted)
cipher = AES(b'0123456789ABCDEF', b'\x00'*16)
decrypted = cipher.CTR_xcrypt_buffer(encrypted)
print("decrypted:", decrypted)
test: install dev-install
just PY={{PY}} run "just _test && just _test_null_iv"
just PY={{PY}} run "python -m pytest . -v"
dist:
just PY={{PY}} run "python -m pip install -r requirements-dist.txt"
just PY={{PY}} run "python setup.py sdist bdist_wheel"
@echo "-------------------------------------------------------------------"
@echo "Now you can publish with 'twine upload dist/*{{VERSION}}*.tar.gz'!!"
ls -l dist/*{{VERSION}}*.tar.gz
@echo "Do not forget to test bigger changes on TestPyPI:"
@echo "https://packaging.python.org/guides/using-testpypi/#using-test-pypi"
@echo "-------------------------------------------------------------------"
audit: dist
just PY={{PY}} run "python -m auditwheel show dist/*{{VERSION}}*.whl"
@echo "-------------------------------------------------------------------"
just PY={{PY}} run "python -m auditwheel repair dist/*{{VERSION}}*.whl"
@echo "-------------------------------------------------------------------"
ls -l wheelhouse/*{{VERSION}}*.whl