# HG changeset patch # User Gustavo Andres Morero # Date 1504121796 10800 # Wed Aug 30 16:36:36 2017 -0300 # Node ID aac071a66f9771a7fe0f68196a4b671dc7a74f2e # Parent 75eb30a02aac26403617b8b9eba9750a2b52e294 adding basic setup.py. diff --git a/form_guard/__init__.py b/form_guard/__init__.py --- a/form_guard/__init__.py +++ b/form_guard/__init__.py @@ -0,0 +1,24 @@ +VERSION = (0, 1, 0, 'final', 0) + + +# taken from django-registration + +def get_version(): + "Returns a PEP 386-compliant version number from VERSION." + assert len(VERSION) == 5 + assert VERSION[3] in ('alpha', 'beta', 'rc', 'final') + + # Now build the two parts of the version number: + # main = X.Y[.Z] + # sub = .devN - for pre-alpha releases + # | {a|b|c}N - for alpha, beta and rc releases + + parts = 2 if VERSION[2] == 0 else 3 + main = '.'.join(str(x) for x in VERSION[:parts]) + + sub = '' + if VERSION[3] != 'final': + mapping = {'alpha': 'a', 'beta': 'b', 'rc': 'c'} + sub = mapping[VERSION[3]] + str(VERSION[4]) + + return str(main + sub) diff --git a/setup.py b/setup.py new file mode 100644 --- /dev/null +++ b/setup.py @@ -0,0 +1,53 @@ +import os +from distutils.core import setup + +project_name = 'form_guard' + +# Idea from django-registration setup.py +packages, data_files = [], [] +root_dir = os.path.dirname(__file__) +if root_dir: + os.chdir(root_dir) + +for dirpath, dirnames, filenames in os.walk(project_name): + # Ignore dirnames that start with '.' + for i, dirname in enumerate(dirnames): + if dirname.startswith('.') or dirname == '__pycache__': + del dirnames[i] + if '__init__.py' in filenames: + pkg = dirpath.replace(os.path.sep, '.') + if os.path.altsep: + pkg = pkg.replace(os.path.altsep, '.') + packages.append(pkg) + elif filenames: + prefix = dirpath[(len(project_name) + 1):] + for f in filenames: + data_files.append(os.path.join(prefix, f)) + +setup( + name='django-form-guard', + version=__import__(project_name).get_version(), + package_dir={project_name: project_name}, + packages=packages, + package_data={project_name: data_files}, + description='Django Form Guard', + author='Netlandish Inc.', + author_email='geeks@netlandish.com', + license='BSD License', + url='http://bitbucket.org/netlandish/django-form-guard/', + long_description='Django Form Guard', + install_requires=['Django >= 1.7.0'], + platforms=['any'], + classifiers=[ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: BSD License', + 'Natural Language :: English', + 'Operating System :: OS Independent', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3.3', + 'Programming Language :: Python :: 3.4', + 'Environment :: Web Environment', + ], +)