Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Commit

Permalink
Handle the version in setup.py
Browse files Browse the repository at this point in the history
and use pkg_resources to get the installed version in the project itself.
  • Loading branch information
almet committed Jun 19, 2013
1 parent 85d3079 commit ac82579
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
4 changes: 3 additions & 1 deletion hawk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
"""

import pkg_resources

__title__ = 'pyhawk'
__version__ = '0.1.0'
__version__ = pkg_resources.get_distribution(__title__).version
__build__ = 0x010200
__copyright__ = 'Copyright 2013 Mozilla'

Expand Down
12 changes: 1 addition & 11 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,18 @@

import codecs
import os
import re
from setuptools import setup


def read(*parts):
return codecs.open(os.path.join(os.path.dirname(__file__), *parts)).read()

def find_version(*file_paths):
version_file = read(*file_paths)
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.")


README = read('README.rst')
CHANGELOG = read('CHANGES.txt')

setup(
name="PyHawk",
version=find_version('hawk/__init__.py'),
version="0.1.0",
url='https://github.com/mozilla/PyHawk',
author='Austin King',
author_email='ozten@mozilla.com',
Expand Down

0 comments on commit ac82579

Please sign in to comment.