Skip to content

HTTPS clone URL

Subversion checkout URL

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