Skip to content

Commit

Permalink
refactored metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
wolph committed Sep 8, 2017
1 parent facb849 commit 7baed63
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 24 deletions.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('..'))
os.environ['DJANGO_SETTINGS_MODULE'] = 'example.settings'
from tags_input import metadata
from tags_input import __about__ as metadata

# -- General configuration -----------------------------------------------------

Expand Down
4 changes: 2 additions & 2 deletions example/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ def setUp(self):
assert foo_extra_spam

def test_metadata(self):
from tags_input import metadata
assert metadata
from tags_input import __about__
assert __about__

# Utils Test Cases
@pytest.mark.xfail(raises=TypeError)
Expand Down
29 changes: 18 additions & 11 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,20 @@
import setuptools
from setuptools.command.test import test as TestCommand

from tags_input import metadata

# To prevent importing about and thereby breaking the coverage info we use this
# exec hack
about = {}
with open('tags_input/__about__.py') as fp:
exec(fp.read(), about)


if os.path.isfile('README.rst'):
long_description = open('README.rst').read()
with open('README.rst') as fh:
readme = fh.read()
else:
long_description = ('See http://pypi.python.org/pypi/' +
metadata.__package_name__)
readme = \
'See http://pypi.python.org/pypi/%(__package_name__)s/' % about


class PyTest(TestCommand):
Expand All @@ -26,12 +33,12 @@ def run_tests(self):


setuptools.setup(
name=metadata.__package_name__,
version=metadata.__version__,
author=metadata.__author__,
author_email=metadata.__author_email__,
description=metadata.__description__,
url=metadata.__url__,
name=about['__package_name__'],
version=about['__version__'],
author=about['__author__'],
author_email=about['__email__'],
description=about['__description__'],
url=about['__url__'],
license='BSD',
packages=setuptools.find_packages(exclude=[
'example',
Expand All @@ -46,7 +53,7 @@ def run_tests(self):
'static/css/base/images/*.png',
],
},
long_description=long_description,
long_description=readme,
cmdclass={'test': PyTest},
classifiers=['License :: OSI Approved :: BSD License'],
install_requires=[
Expand Down
11 changes: 11 additions & 0 deletions tags_input/__about__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
__package_name__ = 'django-tags-input'
__version__ = '3.2.0'
__author__ = 'Rick van Hattem'
__email__ = 'wolph@wol.ph'
__description__ = ' '.join('''
Django jQuery Tags Input is a Django field and widget wrapper that adds an easy
to use interface for `ManyToManyField` and `ForeignKey` fields in the forms of
autocompleting tags with optionally live creation of new linked
items
'''.strip().split())
__url__ = 'https://github.com/WoLpH/django-tags-input'
10 changes: 0 additions & 10 deletions tags_input/metadata.py

This file was deleted.

0 comments on commit 7baed63

Please sign in to comment.