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

Commit

Permalink
Add CI on Mac OS (#123)
Browse files Browse the repository at this point in the history
* Parameterize OS image

* Add MacOS CI

* Fix install on Python 2.7 on MacOS
  • Loading branch information
c-w authored May 13, 2019
1 parent d1ef3da commit 72b0952
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 49 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
!tests/
!.coveragerc
!.noserc
!MANIFEST.in
!README.rst
!requirements*.pip
!setup.py
3 changes: 0 additions & 3 deletions MANIFEST.in

This file was deleted.

5 changes: 3 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
*****
Expand All @@ -101,7 +101,7 @@ On Mac, you can install BSD-DB using `homebrew <https://homebrew.sh/>`_:
.. sourcecode :: sh
brew install berkeley-db4
pip install -r requirements-py3.pip
pip install .
Windows
*******
Expand All @@ -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
*****************
Expand Down
37 changes: 31 additions & 6 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 .
Expand Down
1 change: 0 additions & 1 deletion requirements-py2.pip

This file was deleted.

1 change: 0 additions & 1 deletion requirements-py3.pip

This file was deleted.

7 changes: 0 additions & 7 deletions requirements.pip

This file was deleted.

46 changes: 18 additions & 28 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,42 +1,33 @@
"""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

from setuptools import find_packages
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()
Expand All @@ -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=[
Expand Down

0 comments on commit 72b0952

Please sign in to comment.