mirror of
https://github.com/jazzband/django-admin2.git
synced 2026-03-16 22:20:24 +00:00
Fixing setup.py if django is not installed.
djadmin2 must not be imported in setup.py because this triggers an import of django and other dependencies which will obviously fail if they are not installed.
This commit is contained in:
parent
f761b7137d
commit
06aa019898
1 changed files with 11 additions and 4 deletions
15
setup.py
15
setup.py
|
|
@ -7,12 +7,20 @@ import os
|
|||
import sys
|
||||
|
||||
|
||||
def get_author(package):
|
||||
"""
|
||||
Return package version as listed in `__version__` in `init.py`.
|
||||
"""
|
||||
init_py = open(os.path.join(package, '__init__.py')).read()
|
||||
return re.search("__author__ = ['\"]([^'\"]+)['\"]", init_py).group(1)
|
||||
|
||||
|
||||
def get_version(package):
|
||||
"""
|
||||
Return package version as listed in `__version__` in `init.py`.
|
||||
"""
|
||||
init_py = open(os.path.join(package, '__init__.py')).read()
|
||||
return re.match("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1)
|
||||
return re.search("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1)
|
||||
|
||||
|
||||
def get_packages(package):
|
||||
|
|
@ -40,6 +48,7 @@ def get_package_data(package):
|
|||
return {package: filepaths}
|
||||
|
||||
|
||||
author = get_author('djadmin2')
|
||||
version = get_version('djadmin2')
|
||||
|
||||
|
||||
|
|
@ -50,8 +59,6 @@ if sys.argv[-1] == 'publish':
|
|||
print(" git push --tags")
|
||||
sys.exit()
|
||||
|
||||
import djadmin2
|
||||
|
||||
LONG_DESCRIPTION = open('README.rst').read()
|
||||
|
||||
setup(
|
||||
|
|
@ -73,7 +80,7 @@ setup(
|
|||
"Topic :: Software Development :: Libraries :: Python Modules",
|
||||
],
|
||||
keywords='django,admin',
|
||||
author=djadmin2.__author__,
|
||||
author=author,
|
||||
author_email='pydanny@gmail.com',
|
||||
url='http://github.com/pydanny/django-admin2',
|
||||
license='MIT',
|
||||
|
|
|
|||
Loading…
Reference in a new issue