|
| 1 | +import os |
1 | 2 | from codecs import open as codecs_open
|
| 3 | +import re |
2 | 4 | from setuptools import setup, find_packages
|
3 |
| -from tiling import __version__ |
4 | 5 |
|
5 | 6 |
|
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') |
9 | 23 |
|
10 | 24 |
|
11 | 25 | setup(
|
12 | 26 | name="tiling",
|
13 |
| - version=__version__, |
| 27 | + version=version, |
14 | 28 | description=u"Minimalistic set of image reader agnostic tools to easily iterate over large images",
|
15 | 29 | long_description=long_description,
|
16 | 30 | author="vfdev-5",
|
17 | 31 | author_email="vfdev dot 5 at gmail dot com",
|
| 32 | + url="https://github.com/vfdev-5/ImageTilingUtils", |
18 | 33 | packages=find_packages(exclude=['tests', 'examples']),
|
19 | 34 | install_requires=[
|
20 | 35 | 'numpy',
|
|
0 commit comments