Skip to content

Commit ed9569d

Browse files
committed
Update setup.py and travis.yml
1 parent 80db8b3 commit ed9569d

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ matrix:
66
- python: 2.7
77

88
install:
9-
- pip install numpy
109
- python setup.py install
1110
- pip install flake8 coveralls pytest-cov
1211

1312
# command to run tests
1413
script:
15-
- py.test --cov tiling --cov-report term-missing
1614
- flake8
15+
- py.test --cov tiling --cov-report term-missing
16+
1717

1818
after_success:
1919
- coveralls

setup.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,35 @@
1+
import os
12
from codecs import open as codecs_open
3+
import re
24
from setuptools import setup, find_packages
3-
from tiling import __version__
45

56

6-
# Get the long description from the relevant file
7-
with codecs_open('README.md', encoding='utf-8') as f:
8-
long_description = f.read()
7+
def read(*names):
8+
with codecs_open(os.path.join(os.path.dirname(__file__), *names),
9+
encoding="utf-8") as fp:
10+
return fp.read()
11+
12+
13+
def find_version(*file_paths):
14+
version_file = read(*file_paths)
15+
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M)
16+
if version_match:
17+
return version_match.group(1)
18+
raise RuntimeError("Unable to find version string.")
19+
20+
21+
long_description = read("README.md")
22+
version = find_version('tiling', '__init__.py')
923

1024

1125
setup(
1226
name="tiling",
13-
version=__version__,
27+
version=version,
1428
description=u"Minimalistic set of image reader agnostic tools to easily iterate over large images",
1529
long_description=long_description,
1630
author="vfdev-5",
1731
author_email="vfdev dot 5 at gmail dot com",
32+
url="https://github.com/vfdev-5/ImageTilingUtils",
1833
packages=find_packages(exclude=['tests', 'examples']),
1934
install_requires=[
2035
'numpy',

0 commit comments

Comments
 (0)