Skip to content

Commit

Permalink
Move version to a separate file. Fixes thinkwelltwd#7
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleks Pietrow committed Sep 26, 2018
1 parent aea8e5d commit d31658e
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
#!/usr/bin/env python3
import io
import os
import re
from setuptools import setup, find_packages
import device_detector


def get_version():
with open('device_detector/__init__.py', 'r') as f:
line = f.readline()
match = re.match(r'__version__ = \'([\d\.]+)\'', line)

if not match:
raise ImportError("Can't read the version of device_detector")

version = match.group(0)
return version


here = os.path.abspath(os.path.dirname(__file__))
with io.open(os.path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = '\n' + f.read()

setup(
name='device_detector',
version=device_detector.__version__,
version=get_version(),
description="Python3 port of matomo's Device Detector",
long_description=long_description,
author='Dave Burkholder',
Expand Down

0 comments on commit d31658e

Please sign in to comment.