Skip to content

Commit 7940be4

Browse files
authored
Merge pull request #40 from maxmind/andy/travis-runs-snyk
Run snyk checks on requirements, but only for python 2.7
2 parents 08fd056 + 3cb21ba commit 7940be4

File tree

4 files changed

+40
-25
lines changed

4 files changed

+40
-25
lines changed

.travis.yml

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
11
language: python
2-
3-
python:
4-
- 2.6
5-
- 2.7
6-
- 3.3
7-
- 3.4
8-
- 3.5
9-
- 3.6
10-
- 3.7-dev
11-
- pypy
2+
matrix:
3+
include:
4+
- python: 2.7
5+
dist: trusty
6+
- python: 3.3
7+
dist: trusty
8+
- python: 3.4
9+
dist: trusty
10+
- python: 3.5
11+
dist: trusty
12+
- python: 3.6
13+
dist: trusty
14+
- python: 3.7
15+
dist: xenial
16+
- python: nightly
17+
dist: xenial
18+
- python: pypy
19+
dist: trusty
20+
allow_failures:
21+
- python: nightly
1222

1323
before_install:
1424
- git submodule update --init --recursive
@@ -21,17 +31,23 @@ before_install:
2131
- sudo ldconfig
2232
- cd ..
2333
- pip install coverage coveralls
24-
- if [[ $TRAVIS_PYTHON_VERSION == '3.6' ]]; then pip install pylint yapf; fi
25-
- if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then pip install unittest2; fi
34+
- if [[ $TRAVIS_PYTHON_VERSION == '3.7' ]]; then pip install pylint yapf; fi
35+
- |
36+
if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then
37+
sudo apt-get install -y nodejs;
38+
npm install -g snyk;
39+
fi
2640
2741
script:
2842
- if [[ $TRAVIS_PYTHON_VERSION != 'pypy' ]]; then export MM_FORCE_EXT_TESTS=1; fi
2943
- CFLAGS="-Werror -Wall -Wextra" coverage run --source maxminddb setup.py test
30-
- if [[ $TRAVIS_PYTHON_VERSION == '3.6' ]]; then pylint --rcfile .pylintrc maxminddb/*.py; fi
31-
- if [[ $TRAVIS_PYTHON_VERSION == '3.6' ]]; then ./.travis-yapf.sh; fi
44+
- if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then snyk test --org=maxmind --file=requirements.txt; fi
45+
- if [[ $TRAVIS_PYTHON_VERSION == '3.7' ]]; then pylint --rcfile .pylintrc maxminddb/*.py; fi
46+
- if [[ $TRAVIS_PYTHON_VERSION == '3.7' ]]; then ./.travis-yapf.sh; fi
3247

3348
after_success:
3449
- coveralls
50+
- if [[ $TRAVIS_BRANCH == 'master' && $TRAVIS_PULL_REQUEST == 'false' && $TRAVIS_PYTHON_VERSION == '2.7' ]]; then snyk monitor --org=maxmind --project=maxmind/MaxMind-DB-Reader-python; fi
3551

3652
notifications:
3753
email:
@@ -42,7 +58,8 @@ notifications:
4258

4359
env:
4460
global:
45-
- secure: "pVcpV/al5Q607TbRzl/sbkdsx5hUjxehaJm6t5tgWrFn45icwdZrPw3JWcpt0R57NhPvXHxcJdm4WBtcGElWoDtR52QOW3yYh+gRw23y1MJg+5qHIbh5R1sOC/fLJ9TzQzvvRH5QQ5bKIe1hRQW9Cpqm7nX5Zhq6SqnAzcG1emE="
61+
- secure: "pVcpV/al5Q607TbRzl/sbkdsx5hUjxehaJm6t5tgWrFn45icwdZrPw3JWcpt0R57NhPvXHxcJdm4WBtcGElWoDtR52QOW3yYh+gRw23y1MJg+5qHIbh5R1sOC/fLJ9TzQzvvRH5QQ5bKIe1hRQW9Cpqm7nX5Zhq6SqnAzcG1emE="
62+
- secure: "idzTTvCWmC0TYgYxQFOaZju86TUzKLaMKs2ZZsGloklf0mk0d3XH/CD5VYDPgP++/7Kmw9zC401EZyRC6anZYB0qCXwRulgux2Io5HCWChIrZTSx3DoSl+VRVi0cUkfMNomrwduJ0g1vVnDXp6xM8ITE574jwpasUJ2MOvVykdU="
4663

4764
addons:
4865
coverity_scan:

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ invalid IP address or an IPv6 address in an IPv4 database.
8585
Requirements
8686
------------
8787

88-
This code requires Python 2.6+ or 3.3+. The C extension requires CPython. The
88+
This code requires Python 2.7+ or 3.3+. The C extension requires CPython. The
8989
pure Python implementation has been tested with PyPy.
9090

9191
On Python 2, the `ipaddress module <https://pypi.python.org/pypi/ipaddress>`_ is

setup.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
if sys.version_info[0] == 2 or (sys.version_info[0] == 3
2020
and sys.version_info[1] < 3):
2121
requirements.append('ipaddress')
22+
if os.environ.get('SNYK_TOKEN'):
23+
with open('requirements.txt', 'w') as f:
24+
for r in requirements:
25+
f.write(r + '\n')
2226

2327
compile_args = ['-Wall', '-Wextra']
2428

@@ -37,10 +41,6 @@
3741
# Cargo cult code for installing extension with pure Python fallback.
3842
# Taken from SQLAlchemy, but this same basic code exists in many modules.
3943
ext_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError)
40-
if sys.platform == 'win32':
41-
# 2.6's distutils.msvc9compiler can raise an IOError when failing to
42-
# find the compiler
43-
ext_errors += (IOError, )
4444

4545

4646
class BuildFailed(Exception):
@@ -141,12 +141,13 @@ def run_setup(with_cext):
141141
'Intended Audience :: Developers',
142142
'Intended Audience :: System Administrators',
143143
'License :: OSI Approved :: Apache Software License',
144-
'Programming Language :: Python :: 2.6',
145144
'Programming Language :: Python :: 2.7',
146145
'Programming Language :: Python :: 3',
147146
'Programming Language :: Python :: 3.3',
148147
'Programming Language :: Python :: 3.4',
149148
'Programming Language :: Python :: 3.5',
149+
'Programming Language :: Python :: 3.6',
150+
'Programming Language :: Python :: 3.7',
150151
'Programming Language :: Python',
151152
'Topic :: Internet :: Proxy Servers',
152153
'Topic :: Internet',

tests/decoder_test.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@
99
from maxminddb.compat import byte_from_int, int_from_byte
1010
from maxminddb.decoder import Decoder
1111

12-
if sys.version_info[:2] == (2, 6):
13-
import unittest2 as unittest
14-
else:
15-
import unittest
12+
import unittest
1613

1714
if sys.version_info[0] == 2:
1815
unittest.TestCase.assertRaisesRegex = unittest.TestCase.assertRaisesRegexp

0 commit comments

Comments
 (0)