Skip to content
This repository has been archived by the owner on Jul 10, 2023. It is now read-only.

Commit

Permalink
Merge pull request #419 from zdict/issue-418
Browse files Browse the repository at this point in the history
  • Loading branch information
Frank Jheng committed May 29, 2020
2 parents 559ce89 + b2edc12 commit 1c14af0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Expand Up @@ -56,9 +56,9 @@ variables:
- run:
name: install dependencies
command: |
pip install --user -U pip
python3 -m venv venv
. venv/bin/activate
pip install -U pip
pip install -r requirements.txt
pip install -r requirements-test.txt
pip install coveralls
Expand Down Expand Up @@ -124,9 +124,9 @@ jobs:
- run:
name: install dependencies
command: |
pip install --user -U pip
python3 -m venv venv
. venv/bin/activate
pip install -U pip
pip install -r requirements-test.txt
pip install twine
Expand Down
28 changes: 13 additions & 15 deletions setup.py
Expand Up @@ -4,17 +4,17 @@
from setuptools import find_packages, setup
from setuptools.command.test import test as TestCommand

try:
# for pip >= 10
from pip._internal.req import parse_requirements
except ImportError:
# for pip <= 9.0.3
from pip.req import parse_requirements


ROOT_DIR = os.path.dirname(os.path.realpath(__file__))


def parse_requirements(filepath):
""" load requirements from a pip requirements file. """
with open(filepath) as f:
lines = (line.strip() for line in f)
return [line for line in lines if line and not line.startswith('#')]


def get_zdict_version():
constants_file_path = os.path.join(ROOT_DIR, 'zdict/constants.py')
with open(constants_file_path) as constants:
Expand All @@ -28,14 +28,13 @@ def get_zdict_version():

def get_test_req():
test_requirements = parse_requirements(
os.path.join(ROOT_DIR, 'requirements-test.txt'), session=False
os.path.join(ROOT_DIR, 'requirements-test.txt')
)
test_requires = [str(tr.req) for tr in test_requirements]

if not sys.platform.startswith('freebsd'):
test_requires.append('gnureadline==6.3.3')
test_requirements.append('gnureadline==6.3.3')

return test_requires
return test_requirements


version = get_zdict_version()
Expand All @@ -61,18 +60,17 @@ def run_tests(self):


install_requirements = parse_requirements(
os.path.join(ROOT_DIR, 'requirements.txt'), session=False
os.path.join(ROOT_DIR, 'requirements.txt')
)
install_requires = [str(ir.req) for ir in install_requirements]

if sys.platform == 'darwin' and sys.version_info <= (3, 5):
install_requires.append('gnureadline==6.3.3')
install_requirements.append('gnureadline==6.3.3')


setup(
packages=find_packages(exclude=['scripts']),
scripts=['scripts/zdict'],
install_requires=install_requires,
install_requires=install_requirements,
tests_require=get_test_req(),
cmdclass={'test': PyTest},

Expand Down

0 comments on commit 1c14af0

Please sign in to comment.