Skip to content

Commit f2e31ce

Browse files
committed
tweak requirements and provide methods to generate it
1 parent 05a3c0d commit f2e31ce

6 files changed

+73
-30
lines changed

.travis.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ python:
2020
- "3.8"
2121

2222
install:
23-
- pip install -r test-requirements.txt
23+
- pip --upgarde pip
24+
- ./mk-requires.sh
25+
- pip install -r requirements.txt
2426

2527
script:
2628
- wget -q "$LIBGIT2_SRC_URL" -O $LIBGIT2_TAR_NAME
2729
- tar -xzf $LIBGIT2_TAR_NAME
2830
- (cd $LIBGIT2_DIR_NAME; cmake . -DMAKE_INSTALL_PREFIX=${LIBGIT2} && make -j 5 install)
29-
- pip install --upgrade pip
30-
- pip install --upgrade -r <( bash pkg/generate-requirements.sh )
3131
- pytest tests/unittests

mk-requires.sh

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
3+
D="$(dirname "$0")"
4+
F="$D/requirements.txt"
5+
6+
echo "# This file was generated by $0" > "$F"
7+
echo "# $(date -u)" >> "$F"
8+
echo >> "$F"
9+
10+
bash "$D/pkg/generate-requirements.sh" "$@" | tee -a "$F"
11+
12+
CMD=( pip install --upgrade -r requirements.txt )
13+
14+
read -ep "issue ${CMD[*]}? [Y/n]" YN
15+
[[ "$YN" =~ [Nn] ]] || "${CMD[@]}"

pkg/generate-requirements.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@ cat "$setup_py_dir/hubblestack.egg-info/requires.txt" \
88
"$setup_py_dir/optional-requirements.txt" \
99
"$setup_py_dir/package-requirements.txt" \
1010
"$setup_py_dir/test-requirements.txt" \
11+
\
1112
| tr A-Z a-z | grep -v ^# | grep . | sort -u \
12-
| perl -ne 'chomp; $P{$1} = $_ if m/^([^<>=]+)/; END { print "$_\n" for sort values %P }'
13+
| perl -ne 'chomp; $P{$1} = $_ if m/^([^<>=]+)/ and length($_) > length($P{$1});
14+
END { print "$_\n" for sort values %P }'

requirements.txt

+47-16
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,52 @@
1-
ntplib
2-
distro
3-
pyinstaller==3.3.1
4-
Crypto
5-
pyopenssl>=16.2.0
1+
# This file was generated by ./mk-requires.sh
2+
# Wed Mar 18 14:02:09 UTC 2020
3+
4+
ansi2html
65
argparse
7-
requests>=2.13.0
8-
pprint
9-
daemon
6+
azure-storage-blob==2.1.0
7+
azure-storage-common==2.1.0
8+
azure==4.0.0
9+
backports-abc
10+
bandit
1011
boto3
1112
botocore
12-
pygit2<0.27.0
13-
salt-ssh
14-
gitpython
15-
pyinotify
13+
certifi
1614
cffi
17-
azure
18-
azure-storage-common
19-
azure-storage-blob
15+
chardet
2016
croniter
21-
vulners
17+
cryptography
18+
daemon
19+
futures
20+
gitdb2
21+
gitpython
22+
gprof2dot
23+
idna
24+
jinja2
25+
markupsafe
26+
mock
27+
msgpack
28+
ntplib
29+
patch==1.*
30+
pprint
31+
pycryptodome
32+
pygit2<0.27.0
33+
pyinotify
34+
pyinstaller-hooks
35+
pyinstaller==3.6
36+
pylint
37+
pyopenssl>=16.2.0
38+
pytest
39+
pytest-cov
40+
pytest-html
41+
pytest-pythonpath
42+
python-dateutil
43+
pyyaml
44+
requests>=2.13.0
45+
salt-ssh==2019.2.3
46+
saltpylint
47+
singledispatch
48+
six
49+
smmap2
50+
tornado
51+
urllib3
52+
vulners

setup.py

+5-7
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
# Default to CentOS7
1414
data_files = [('/usr/lib/systemd/system', ['pkg/source/hubble.service']),
1515
('/etc/hubble', ['conf/hubble']), ]
16-
dependencies = [
16+
17+
build_dependencies = [
1718
'pycryptodome',
1819
'cryptography',
1920
'pyopenssl>=16.2.0',
@@ -28,7 +29,7 @@
2829
'vulners',
2930
'ntplib',
3031
'patch==1.*',
31-
]
32+
]
3233

3334
if distro == 'redhat' or distro == 'centos':
3435
if version.startswith('6'):
@@ -42,7 +43,7 @@
4243
('/etc/hubble', ['conf/hubble']), ]
4344

4445
if platform_name == 'Windows':
45-
dependencies.remove('pyinotify')
46+
build_dependencies.remove('pyinotify')
4647

4748
with open('hubblestack/__init__.py', 'r') as fd:
4849
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
@@ -64,10 +65,7 @@
6465
'hubble = hubblestack.daemon:run',
6566
],
6667
},
67-
tests_require=[
68-
'mock',
69-
],
70-
install_requires=dependencies,
68+
install_requires=build_dependencies,
7169
data_files=data_files,
7270
options={
7371
# 'build_scripts': {

test-requirements.txt

-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
argparse
2-
crypto
32
daemon
43
pprint
54
backports-abc
@@ -17,8 +16,6 @@ markupsafe
1716
mock
1817
msgpack
1918
ntplib
20-
cryptography
21-
pycryptodome
2219
pyinotify
2320
pytest
2421
pytest-cov

0 commit comments

Comments
 (0)