From 72b095248ead05a8b5fc6f474f2b77605de438f8 Mon Sep 17 00:00:00 2001 From: Clemens Wolff Date: Mon, 13 May 2019 16:15:32 -0400 Subject: [PATCH] Add CI on Mac OS (#123) * Parameterize OS image * Add MacOS CI * Fix install on Python 2.7 on MacOS --- .dockerignore | 1 - MANIFEST.in | 3 --- README.rst | 5 +++-- azure-pipelines.yml | 37 +++++++++++++++++++++++++++++------ requirements-py2.pip | 1 - requirements-py3.pip | 1 - requirements.pip | 7 ------- setup.py | 46 +++++++++++++++++--------------------------- 8 files changed, 52 insertions(+), 49 deletions(-) delete mode 100644 MANIFEST.in delete mode 100644 requirements-py2.pip delete mode 100644 requirements-py3.pip delete mode 100644 requirements.pip diff --git a/.dockerignore b/.dockerignore index 7b17aac..76d2dd6 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,7 +3,6 @@ !tests/ !.coveragerc !.noserc -!MANIFEST.in !README.rst !requirements*.pip !setup.py diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 80bda99..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,3 +0,0 @@ -include requirements.pip -include requirements-py2.pip -include requirements-py3.pip diff --git a/README.rst b/README.rst index 876b75c..89e2635 100644 --- a/README.rst +++ b/README.rst @@ -91,7 +91,7 @@ manager. For example, on Ubuntu, you can use apt-get: sudo apt-get install libdb++-dev export BERKELEYDB_DIR=/usr - pip install -r requirements-py3.pip + pip install . MacOS ***** @@ -101,7 +101,7 @@ On Mac, you can install BSD-DB using `homebrew `_: .. sourcecode :: sh brew install berkeley-db4 - pip install -r requirements-py3.pip + pip install . Windows ******* @@ -117,6 +117,7 @@ After you download the wheel, install it and you're good to go: .. sourcecode :: bash pip install bsddb3‑6.2.1‑cp35‑cp35m‑win_amd64.whl + pip install . License conflicts ***************** diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f2981d9..79f5228 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -2,22 +2,42 @@ trigger: - master pool: - vmImage: 'windows-latest' + vmImage: '$(os.image)' strategy: matrix: - Python27: + Windows-Python27: python.version.major: '2' python.version.minor: '7' - Python35: + os.image: 'windows-latest' + Windows-Python35: python.version.major: '3' python.version.minor: '5' - Python36: + os.image: 'windows-latest' + Windows-Python36: python.version.major: '3' python.version.minor: '6' - Python37: + os.image: 'windows-latest' + Windows-Python37: python.version.major: '3' python.version.minor: '7' + os.image: 'windows-latest' + MacOS-Python27: + python.version.major: '2' + python.version.minor: '7' + os.image: 'macOS-latest' + MacOS-Python35: + python.version.major: '3' + python.version.minor: '5' + os.image: 'macOS-latest' + MacOS-Python36: + python.version.major: '3' + python.version.minor: '6' + os.image: 'macOS-latest' + MacOS-Python37: + python.version.major: '3' + python.version.minor: '7' + os.image: 'macOS-latest' steps: - task: UsePythonVersion@0 @@ -34,9 +54,14 @@ steps: $wheel = "bsddb3-6.2.6-cp3$(python.version.minor)-cp3$(python.version.minor)m-win_amd64.whl" Invoke-WebRequest -Uri "$mirror/$wheel" -OutFile "$(Agent.TempDirectory)\$wheel" pip install "$(Agent.TempDirectory)\$wheel" - condition: eq(variables['python.version.major'], '3') + condition: and(eq(variables['python.version.major'], '3'), eq(variables['os.image'], 'windows-latest')) displayName: 'Install bsddb3 wheel' +- script: | + brew install berkeley-db4 + condition: eq(variables['os.image'], 'macOS-latest') + displayName: 'Install bsddb3 dependencies' + - script: | pip install -r requirements-dev.pip pip install . diff --git a/requirements-py2.pip b/requirements-py2.pip deleted file mode 100644 index 8fcb6a6..0000000 --- a/requirements-py2.pip +++ /dev/null @@ -1 +0,0 @@ -functools32>=3.2.3-2 diff --git a/requirements-py3.pip b/requirements-py3.pip deleted file mode 100644 index 1b97276..0000000 --- a/requirements-py3.pip +++ /dev/null @@ -1 +0,0 @@ -bsddb3>=6.1.0 diff --git a/requirements.pip b/requirements.pip deleted file mode 100644 index f0d6c51..0000000 --- a/requirements.pip +++ /dev/null @@ -1,7 +0,0 @@ -future>=0.15.2 -rdflib>=4.2.0 -requests>=2.5.1 -six>=1.10.0 -setuptools>=18.5 -rdflib-sqlalchemy>=0.3.8 -SPARQLWrapper>=1.8.2 diff --git a/setup.py b/setup.py index e6c329b..feb57e7 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ """Library installer.""" from __future__ import absolute_import, unicode_literals -from os.path import isfile +from platform import system from sys import version_info import codecs @@ -9,34 +9,25 @@ from setuptools import setup -def requirements_for(version=None): - suffix = '-py%s' % version if version is not None else '' - pip_path = 'requirements%s.pip' % suffix - - if not isfile(pip_path): - return set(), set() - - requirements = set() - links = set() - with open(pip_path) as pip_file: - for line in pip_file: - line = line.strip() - if '#egg=' in line: - requirement_parts = line.split('#egg=')[-1].split('-') - version = requirement_parts[-1] - library = '-'.join(requirement_parts[:-1]) - requirement = '{}=={}'.format(library, version) - requirements.add(requirement) - links.add(line) - else: - requirements.add(line) - return requirements, links +install_requires = [ + 'future>=0.15.2', + 'rdflib>=4.2.0', + 'requests>=2.5.1', + 'six>=1.10.0', + 'setuptools>=18.5', + 'rdflib-sqlalchemy>=0.3.8', + 'SPARQLWrapper>=1.8.2', +] +if version_info.major == 2: + install_requires.extend([ + 'functools32>=3.2.3-2', + ]) -requirements_general, links_general = requirements_for() -requirements_version, links_version = requirements_for(version_info.major) -install_requires = requirements_general | requirements_version -dependency_links = links_general | links_version +if version_info.major == 3 or system() == 'Darwin': + install_requires.extend([ + 'bsddb3>=6.1.0', + ]) with codecs.open('README.rst', encoding='utf-8') as fobj: long_description = fobj.read() @@ -52,7 +43,6 @@ def requirements_for(version=None): license='Apache Software License', description='Library to interface with Project Gutenberg', long_description=long_description, - dependency_links=dependency_links, install_requires=sorted(install_requires), python_requires='>=2.7.*,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*', classifiers=[