Skip to content

Commit

Permalink
Don't depend on VERSION file
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Martinez committed Jun 22, 2016
1 parent bee715a commit ecd4c40
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 40 deletions.
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
include README.rst
include CHANGES.rst
include VERSION
include LICENSE
include CONTRIBUTORS
include COPYRIGHT
Expand Down
43 changes: 4 additions & 39 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

import os
from setuptools import setup, find_packages
from subprocess import Popen, PIPE
import sys


HERE = os.path.abspath(os.path.dirname(__file__))
Expand All @@ -31,45 +29,12 @@
'zope.interface',
]


EXTRAS = {
'test': ['nose', 'coverage']
}


def get_version():
version_file = os.path.join(HERE, 'VERSION')

# read fallback file
try:
with open(version_file, 'r+') as fp:
version_txt = fp.read().strip()
except:
version_txt = None

# read git version (if available)
try:
version_git = (
Popen(['git', 'describe'], stdout=PIPE, stderr=PIPE, cwd=HERE)
.communicate()[0]
.strip()
.decode(sys.getdefaultencoding()))
except:
version_git = None

version = version_git or version_txt or '0.0.0'

# update fallback file if necessary
if version != version_txt:
with open(version_file, 'w') as fp:
fp.write(version)

return version
TESTS_REQUIRE = ['nose', 'coverage']


setup(
name='who_ldap',
version=get_version(),
version='3.2.1',
description='LDAP plugin for repoze.who',
long_description='\n\n'.join([README, CHANGELOG]),
classifiers=[
Expand All @@ -92,7 +57,7 @@ def get_version():
packages=find_packages('src'),
zip_safe=False,
install_requires=REQUIRES,
extras_require=EXTRAS,
tests_require=EXTRAS['test'],
extras_require={'test': TESTS_REQUIRE},
tests_require=TESTS_REQUIRE,
test_suite='nose.collector'
)

0 comments on commit ecd4c40

Please sign in to comment.