Browse files

Added setup.py for easy "pip -e" installation, and all the necessary …

…files to create a PyPi package as well (allowing a "pip install django-bootstrap" installation). Sweet.
  • Loading branch information...
1 parent 88c9eb6 commit 286357f656735188c1b39367e083c57ad4fecf62 James Addison committed Sep 17, 2011
View
3 .gitignore
@@ -1,4 +1,5 @@
static/
+build/
*.pyc
.DS_Store
-.idea*
+.idea*
View
10 AUTHORS
@@ -0,0 +1,10 @@
+Primary Authors:
+----------------
+
+ * Earle Ady
+
+
+Contributors
+------------
+
+ * James Addison
View
11 MANIFEST
@@ -0,0 +1,11 @@
+AUTHORS
+LICENSE
+README.mkd
+setup.py
+django_bootstrap/__init__.py
+django_bootstrap/models.py
+django_bootstrap/tests.py
+django_bootstrap/forms.py
+django_bootstrap/views.py
+django_bootstrap/templates/bootstrap/field_default.html
+
View
3 MANIFEST.in
@@ -0,0 +1,3 @@
+include AUTHORS
+include LICENSE
+include README.mkd
View
0 __init__.py
No changes.
View
2 django_bootstrap/__init__.py
@@ -0,0 +1,2 @@
+__author__ = 'jaddison'
+
View
0 forms.py → django_bootstrap/forms.py
File renamed without changes.
View
0 models.py → django_bootstrap/models.py
File renamed without changes.
View
0 templates/bootstrap/field_default.html → ...ap/templates/bootstrap/field_default.html
File renamed without changes.
View
0 tests.py → django_bootstrap/tests.py
File renamed without changes.
View
0 views.py → django_bootstrap/views.py
File renamed without changes.
View
62 setup.py
@@ -0,0 +1,62 @@
+import os
+from distutils.core import setup
+
+
+def fullsplit(path, result=None):
+ """
+ Split a pathname into components (the opposite of os.path.join) in a
+ platform-neutral way.
+ """
+ if result is None:
+ result = []
+ head, tail = os.path.split(path)
+ if head == "":
+ return [tail] + result
+ if head == path:
+ return result
+ return fullsplit(head, [tail] + result)
+
+def read(fname):
+ return open(os.path.join(os.path.dirname(__file__), fname)).read()
+
+package_dir = "django_bootstrap"
+
+packages = []
+for dirpath, dirnames, filenames in os.walk(package_dir):
+ # ignore dirnames that start with '.'
+ for i, dirname in enumerate(dirnames):
+ if dirname.startswith("."):
+ del dirnames[i]
+ if "__init__.py" in filenames:
+ packages.append(".".join(fullsplit(dirpath)))
+
+template_patterns = [
+ 'templates/*.html',
+ 'templates/*/*.html',
+ 'templates/*/*/*.html',
+]
+
+package_data = dict(
+ (package_name, template_patterns)
+ for package_name in packages
+)
+
+setup(
+ name = 'django-bootstrap',
+ description = 'Twitter Bootstrap ready Django forms.',
+ long_description=read('README.mkd'),
+ author='Earle Ady',
+ packages = ['django_bootstrap',],
+ package_data = package_data,
+ version = '0.1.0',
+ url='http://github.com/earle/django-bootstrap',
+ keywords=[],
+ license='Apache 2.0',
+ classifiers=[
+ 'Development Status :: 3 - Alpha',
+ 'Intended Audience :: Developers',
+ 'License :: OSI Approved :: BSD License',
+ 'Topic :: Internet :: WWW/HTTP :: WSGI',
+ 'Framework :: Django',
+ ],
+)

0 comments on commit 286357f

Please sign in to comment.