Skip to content
Newer
Older
100644 135 lines (120 sloc) 4.95 KB
9920933 @theju Bumping the version number to upload the newer package to pypi.
theju authored Nov 24, 2011
1 VERSION = (0, 0, 2, "a", 0) # following PEP 386
f72933e @theju Fixes #2. Added a setup.py.
theju authored Nov 17, 2011
2 DEV_N = None
3
4 import os
5 import sys
6 from fnmatch import fnmatchcase
7 from distutils.util import convert_path
8 from setuptools import setup, find_packages
9
10 def read(fname):
11 return open(os.path.join(os.path.dirname(__file__), fname)).read()
12
13 # Provided as an attribute, so you can append to these instead
14 # of replicating them:
15 standard_exclude = ('*.py', '*.pyc', '*$py.class', '*~', '.*', '*.bak')
16 standard_exclude_directories = ('.*', 'CVS', '_darcs', './build',
17 './dist', 'EGG-INFO', '*.egg-info')
18
19 def get_version():
20 version = "%s.%s" % (VERSION[0], VERSION[1])
21 if VERSION[2]:
22 version = "%s.%s" % (version, VERSION[2])
23 if VERSION[3] != "f":
24 version = "%s%s%s" % (version, VERSION[3], VERSION[4])
25 if DEV_N:
26 version = "%s.dev%s" % (version, DEV_N)
27 return version
28
29 # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
30 # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
31 # Note: you may want to copy this into your setup.py file verbatim, as
32 # you can't import this from another package, when you don't know if
33 # that package is installed yet.
34 def find_package_data(
35 where='.', package='',
36 exclude=standard_exclude,
37 exclude_directories=standard_exclude_directories,
38 only_in_packages=True,
39 show_ignored=False):
40 """
41 Return a dictionary suitable for use in ``package_data``
42 in a distutils ``setup.py`` file.
43
44 The dictionary looks like::
45
46 {'package': [files]}
47
48 Where ``files`` is a list of all the files in that package that
49 don't match anything in ``exclude``.
50
51 If ``only_in_packages`` is true, then top-level directories that
52 are not packages won't be included (but directories under packages
53 will).
54
55 Directories matching any pattern in ``exclude_directories`` will
56 be ignored; by default directories with leading ``.``, ``CVS``,
57 and ``_darcs`` will be ignored.
58
59 If ``show_ignored`` is true, then all the files that aren't
60 included in package data are shown on stderr (for debugging
61 purposes).
62
63 Note patterns use wildcards, or can be exact paths (including
64 leading ``./``), and all searching is case-insensitive.
65 """
66
67 out = {}
68 stack = [(convert_path(where), '', package, only_in_packages)]
69 while stack:
70 where, prefix, package, only_in_packages = stack.pop(0)
71 for name in os.listdir(where):
72 fn = os.path.join(where, name)
73 if os.path.isdir(fn):
74 bad_name = False
75 for pattern in exclude_directories:
76 if (fnmatchcase(name, pattern)
77 or fn.lower() == pattern.lower()):
78 bad_name = True
79 if show_ignored:
80 print >> sys.stderr, (
81 "Directory %s ignored by pattern %s"
82 % (fn, pattern))
83 break
84 if bad_name:
85 continue
86 if (os.path.isfile(os.path.join(fn, '__init__.py'))
87 and not prefix):
88 if not package:
89 new_package = name
90 else:
91 new_package = package + '.' + name
92 stack.append((fn, '', new_package, False))
93 else:
94 stack.append((fn, prefix + name + '/', package, only_in_packages))
95 elif package or not only_in_packages:
96 # is a file
97 bad_name = False
98 for pattern in exclude:
99 if (fnmatchcase(name, pattern)
100 or fn.lower() == pattern.lower()):
101 bad_name = True
102 if show_ignored:
103 print >> sys.stderr, (
104 "File %s ignored by pattern %s"
105 % (fn, pattern))
106 break
107 if bad_name:
108 continue
109 out.setdefault(package, []).append(prefix+name)
110 return out
111
112 setup(
113 name="django-production-ready",
114 version=get_version(),
115 description="A Django app that runs simple tests to check if your app is production ready.",
116 long_description=read("README.rst"),
117 author="Agiliq Solutions",
118 author_email="hello@agiliq.com",
119 license="BSD",
120 url="http://github.com/agiliq/django-production-ready",
121 packages=find_packages(),
122 package_data=find_package_data("prodready", only_in_packages=False),
123 classifiers=[
124 "Development Status :: 3 - Alpha",
125 "Environment :: Web Environment",
126 "Intended Audience :: Developers",
127 "License :: OSI Approved :: BSD License",
128 "Operating System :: OS Independent",
129 "Programming Language :: Python",
130 "Framework :: Django",
131 ],
132 zip_safe=False,
133 tests_require=["Django"],
134 )
Something went wrong with that request. Please try again.