Read version into setup.py without importing, to avoid dependency problems

This commit is contained in:
sneakypete81 2013-07-07 10:22:53 +01:00
parent 375fbf5556
commit 11d580aae1
3 changed files with 7 additions and 4 deletions

View file

@ -1,11 +1,10 @@
from openphoto.openphoto_http import OpenPhotoHttp from openphoto.openphoto_http import OpenPhotoHttp
from openphoto.errors import * from openphoto.errors import *
from openphoto._version import __version__
import openphoto.api_photo import openphoto.api_photo
import openphoto.api_tag import openphoto.api_tag
import openphoto.api_album import openphoto.api_album
__version__ = "0.3"
LATEST_API_VERSION = 2 LATEST_API_VERSION = 2
class OpenPhoto(OpenPhotoHttp): class OpenPhoto(OpenPhotoHttp):

1
openphoto/_version.py Normal file
View file

@ -0,0 +1 @@
__version__ = "0.3"

View file

@ -1,12 +1,15 @@
#!/usr/bin/env python #!/usr/bin/env python
import sys import sys
import openphoto
requires = ['requests', 'requests_oauthlib'] requires = ['requests', 'requests_oauthlib']
console_script = """[console_scripts] console_script = """[console_scripts]
openphoto = openphoto.main:main openphoto = openphoto.main:main
""" """
# from openphoto._version import __version__
exec(open("openphoto/_version.py").read())
# Check the Python version # Check the Python version
(major, minor) = sys.version_info[:2] (major, minor) = sys.version_info[:2]
if (major, minor) < (2, 6): if (major, minor) < (2, 6):
@ -24,7 +27,7 @@ except ImportError:
'requires': requires} 'requires': requires}
setup(name='openphoto', setup(name='openphoto',
version=openphoto.__version__, version=__version__,
description='The official Python client library for Trovebox/OpenPhoto', description='The official Python client library for Trovebox/OpenPhoto',
long_description=open("README.rst").read(), long_description=open("README.rst").read(),
author='Pete Burgers, James Walker', author='Pete Burgers, James Walker',