Skip to content

Commit 689a73e

Browse files
committed
Use poetry in Travis
1 parent 9b3a086 commit 689a73e

File tree

4 files changed

+89
-16
lines changed

4 files changed

+89
-16
lines changed

.travis.yml

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,32 @@
11
language: python
22

3+
python:
4+
- "3.6"
5+
36
matrix:
47
include:
5-
- python: 2.7
8+
- env: VENV='2.7'
69
env: PENDULUM_EXTENSIONS=1
7-
- python: 2.7
10+
- env: VENV='2.7'
811
env: PENDULUM_EXTENSIONS=0
9-
- python: 3.4
12+
- env: VENV='3.4'
1013
env: PENDULUM_EXTENSIONS=1
11-
- python: 3.4
14+
- env: VENV='3.4'
1215
env: PENDULUM_EXTENSIONS=0
13-
- python: 3.5
16+
- env: VENV='3.5'
1417
env: PENDULUM_EXTENSIONS=1
15-
- python: 3.5
18+
- env: VENV='3.5'
1619
env: PENDULUM_EXTENSIONS=0
17-
- python: 3.6
20+
- env: VENV=''
1821
env: PENDULUM_EXTENSIONS=1
19-
- python: 3.6
22+
- env: VENV=''
2023
env: PENDULUM_EXTENSIONS=0
21-
- python: pypy
22-
- python: pypy3
24+
- env: VENV='pypy'
25+
- env: VENV='pypy3'
2326

2427
before_install:
2528
- pip install codecov
29+
- pip install poetry
2630

2731
install:
2832
- |
@@ -38,10 +42,17 @@ install:
3842
virtualenv --python="$PYENV_ROOT/versions/pypy-$PYPY_VERSION/bin/python" "$HOME/virtualenvs/pypy-$PYPY_VERSION"
3943
source "$HOME/virtualenvs/pypy-$PYPY_VERSION/bin/activate"
4044
fi
41-
- pip install -r tests-requirements.txt
42-
- python setup.py develop
45+
- |
46+
if [ "$VENV" != "" ]; then
47+
virtualenv --python="$HOME/virtualenv/python$VENV/bin/python" "$HOME/virtualenvs/venv-$VENV"
48+
source "$HOME/virtualenvs/venv-$VENV/bin/activate"
49+
fi
50+
- poetry install -v
51+
- poetry build
52+
- pip --version
53+
- find dist/ -iname pendulum*.tar.gz -exec pip install {} \;
4354

44-
script: py.test --cov=pendulum --cov-config=.coveragerc tests/
55+
script: pytest --cov=pendulum --cov-config=.coveragerc tests/
4556

4657
after_success:
4758
- codecov

build.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import os
2+
import sys
3+
4+
5+
from distutils.core import Extension
6+
7+
from distutils.errors import (CCompilerError, DistutilsExecError,
8+
DistutilsPlatformError)
9+
from distutils.command.build_ext import build_ext
10+
11+
12+
# C Extensions
13+
with_extensions = os.getenv('PENDULUM_EXTENSIONS', None)
14+
15+
if with_extensions == '1' or with_extensions is None:
16+
with_extensions = True
17+
18+
if with_extensions == '0' or hasattr(sys, 'pypy_version_info'):
19+
with_extensions = False
20+
21+
extensions = []
22+
if with_extensions:
23+
extensions = [
24+
Extension('pendulum._extensions._helpers',
25+
['pendulum/_extensions/_helpers.c']),
26+
]
27+
28+
29+
class BuildFailed(Exception):
30+
31+
pass
32+
33+
34+
class ExtBuilder(build_ext):
35+
# This class allows C extension building to fail.
36+
37+
def run(self):
38+
try:
39+
build_ext.run(self)
40+
except (DistutilsPlatformError, FileNotFoundError):
41+
raise BuildFailed()
42+
43+
def build_extension(self, ext):
44+
try:
45+
build_ext.build_extension(self, ext)
46+
except (CCompilerError, DistutilsExecError,
47+
DistutilsPlatformError, ValueError):
48+
raise BuildFailed()
49+
50+
51+
def build(setup_kwargs):
52+
"""
53+
This function is mandatory in order to build the extensions.
54+
"""
55+
setup_kwargs.update({
56+
'ext_modules': extensions,
57+
'cmdclass': {
58+
'build_ext': ExtBuilder
59+
}
60+
})

pendulum/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# -*- coding: utf-8 -*-
22

3-
VERSION = '1.4.2'
3+
VERSION = '1.4.3-beta'

pyproject.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "pendulum"
3-
version = "1.4.2"
3+
version = "1.4.3-beta"
44
description = "Python datetimes made easy."
55

66
license = "MIT"
@@ -16,9 +16,11 @@ repository = "https://github.com/sdispater/pendulum"
1616

1717
keywords = ['datetime', 'date', 'time', 'timezone']
1818

19+
build = "build.py"
20+
1921

2022
[tool.poetry.dependencies]
21-
python = "~2.7 || ^3.4"
23+
python = ">=2.7 || ^3.4"
2224
python-dateutil = "^2.6"
2325
tzlocal = "^1.5"
2426
pytzdata = ">=2018.3"

0 commit comments

Comments
 (0)