Skip to content

Commit

Permalink
Place version info in startables/__init__.py instead of version.py be…
Browse files Browse the repository at this point in the history
…cause the latter made pip install die
  • Loading branch information
jfcorbett committed Sep 5, 2019
1 parent 03121f8 commit 779984c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
19 changes: 14 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,30 @@

from setuptools import setup, find_packages
from os import path
import re

here = path.abspath(path.dirname(__file__))

# Get the long description from the README file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()

# Get the version number from version.py
version = {}
with open(path.join(here, 'version.py')) as fp:
exec(fp.read(), version)

def find_version(*file_paths):
"""
Reads version from a file. Version must be specified explicitly in the file as:
__version__ = "<the version number string>"
"""
version_file = open(path.join(*file_paths), "r").read()
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M)
if version_match:
return version_match.group(1)
raise RuntimeError("Unable to find version string.")


setup(
name='startables',
version=version['__version__'],
version=find_version("startables", "__init__.py"),
description='Reads, writes, and manipulates data stored in StarTable format',
long_description=long_description,
long_description_content_type='text/markdown',
Expand Down
2 changes: 2 additions & 0 deletions startables/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from startables.startables import Table, Bundle, read_csv, read_excel, ColumnMetadata

__version__ = "0.8.1"
1 change: 0 additions & 1 deletion version.py

This file was deleted.

0 comments on commit 779984c

Please sign in to comment.