Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 137 lines (115 sloc) 4.842 kB
a4b5788 @jezdez Went back to using setuptools_git given the fact using file_finder di…
jezdez authored
1 import os
d40de56 @jezdez Added find_package_data to setup.py to find package_data instead of u…
jezdez authored
2 import sys
d043b84 @brosner Cleaned up setup.py style
brosner authored
3
d40de56 @jezdez Added find_package_data to setup.py to find package_data instead of u…
jezdez authored
4 from fnmatch import fnmatchcase
d043b84 @brosner Cleaned up setup.py style
brosner authored
5
d40de56 @jezdez Added find_package_data to setup.py to find package_data instead of u…
jezdez authored
6 from distutils.util import convert_path
15ea3b5 @jezdez Added simple setup.py to package Pinax
jezdez authored
7 from setuptools import setup, find_packages
8
d043b84 @brosner Cleaned up setup.py style
brosner authored
9
3712832 @brosner 0.9a2.dev6
brosner authored
10 VERSION = __import__("pinax").__version__
a4b5788 @jezdez Went back to using setuptools_git given the fact using file_finder di…
jezdez authored
11
d043b84 @brosner Cleaned up setup.py style
brosner authored
12
fa3ac06 @jezdez Removed buildout configuration and moved it to its own repository. Up…
jezdez authored
13 def read(*path):
71a6d84 @jezdez Fixing oversight in setup.py
jezdez authored
14 return open(os.path.join(os.path.abspath(os.path.dirname(__file__)), *path)).read()
f0114e7 @jezdez bumped version to beta1 and added a package_exclude for the stuff we …
jezdez authored
15
d043b84 @brosner Cleaned up setup.py style
brosner authored
16
d40de56 @jezdez Added find_package_data to setup.py to find package_data instead of u…
jezdez authored
17 # Provided as an attribute, so you can append to these instead
18 # of replicating them:
d043b84 @brosner Cleaned up setup.py style
brosner authored
19 standard_exclude = ["*.py", "*.pyc", "*~", ".*", "*.bak"]
20 standard_exclude_directories = [
21 ".*", "CVS", "_darcs", "./build",
22 "./dist", "EGG-INFO", "*.egg-info"
23 ]
d40de56 @jezdez Added find_package_data to setup.py to find package_data instead of u…
jezdez authored
24
25 # Copied from paste/util/finddata.py
d043b84 @brosner Cleaned up setup.py style
brosner authored
26 def find_package_data(where=".", package="", exclude=standard_exclude,
d40de56 @jezdez Added find_package_data to setup.py to find package_data instead of u…
jezdez authored
27 exclude_directories=standard_exclude_directories,
28 only_in_packages=True, show_ignored=False):
29 """
30 Return a dictionary suitable for use in ``package_data``
31 in a distutils ``setup.py`` file.
d043b84 @brosner Cleaned up setup.py style
brosner authored
32
d40de56 @jezdez Added find_package_data to setup.py to find package_data instead of u…
jezdez authored
33 The dictionary looks like::
d043b84 @brosner Cleaned up setup.py style
brosner authored
34
35 {"package": [files]}
36
d40de56 @jezdez Added find_package_data to setup.py to find package_data instead of u…
jezdez authored
37 Where ``files`` is a list of all the files in that package that
38 don't match anything in ``exclude``.
d043b84 @brosner Cleaned up setup.py style
brosner authored
39
d40de56 @jezdez Added find_package_data to setup.py to find package_data instead of u…
jezdez authored
40 If ``only_in_packages`` is true, then top-level directories that
41 are not packages won't be included (but directories under packages
42 will).
d043b84 @brosner Cleaned up setup.py style
brosner authored
43
d40de56 @jezdez Added find_package_data to setup.py to find package_data instead of u…
jezdez authored
44 Directories matching any pattern in ``exclude_directories`` will
45 be ignored; by default directories with leading ``.``, ``CVS``,
46 and ``_darcs`` will be ignored.
d043b84 @brosner Cleaned up setup.py style
brosner authored
47
d40de56 @jezdez Added find_package_data to setup.py to find package_data instead of u…
jezdez authored
48 If ``show_ignored`` is true, then all the files that aren't
49 included in package data are shown on stderr (for debugging
50 purposes).
d043b84 @brosner Cleaned up setup.py style
brosner authored
51
d40de56 @jezdez Added find_package_data to setup.py to find package_data instead of u…
jezdez authored
52 Note patterns use wildcards, or can be exact paths (including
53 leading ``./``), and all searching is case-insensitive.
54 """
d043b84 @brosner Cleaned up setup.py style
brosner authored
55
d40de56 @jezdez Added find_package_data to setup.py to find package_data instead of u…
jezdez authored
56 out = {}
d043b84 @brosner Cleaned up setup.py style
brosner authored
57 stack = [(convert_path(where), "", package, only_in_packages)]
d40de56 @jezdez Added find_package_data to setup.py to find package_data instead of u…
jezdez authored
58 while stack:
59 where, prefix, package, only_in_packages = stack.pop(0)
60 for name in os.listdir(where):
61 fn = os.path.join(where, name)
62 if os.path.isdir(fn):
63 bad_name = False
64 for pattern in exclude_directories:
65 if (fnmatchcase(name, pattern)
66 or fn.lower() == pattern.lower()):
67 bad_name = True
68 if show_ignored:
69 print >> sys.stderr, (
70 "Directory %s ignored by pattern %s"
71 % (fn, pattern))
72 break
73 if bad_name:
74 continue
d043b84 @brosner Cleaned up setup.py style
brosner authored
75 if (os.path.isfile(os.path.join(fn, "__init__.py"))
d40de56 @jezdez Added find_package_data to setup.py to find package_data instead of u…
jezdez authored
76 and not prefix):
77 if not package:
78 new_package = name
79 else:
d043b84 @brosner Cleaned up setup.py style
brosner authored
80 new_package = package + "." + name
81 stack.append((fn, "", new_package, False))
d40de56 @jezdez Added find_package_data to setup.py to find package_data instead of u…
jezdez authored
82 else:
d043b84 @brosner Cleaned up setup.py style
brosner authored
83 stack.append((fn, prefix + name + "/", package, only_in_packages))
d40de56 @jezdez Added find_package_data to setup.py to find package_data instead of u…
jezdez authored
84 elif package or not only_in_packages:
85 # is a file
86 bad_name = False
87 for pattern in exclude:
88 if (fnmatchcase(name, pattern)
89 or fn.lower() == pattern.lower()):
90 bad_name = True
91 if show_ignored:
92 print >> sys.stderr, (
93 "File %s ignored by pattern %s"
94 % (fn, pattern))
95 break
96 if bad_name:
97 continue
98 out.setdefault(package, []).append(prefix+name)
99 return out
100
d043b84 @brosner Cleaned up setup.py style
brosner authored
101
102 excluded_directories = standard_exclude_directories + ["./requirements", "./scripts"]
d40de56 @jezdez Added find_package_data to setup.py to find package_data instead of u…
jezdez authored
103 package_data = find_package_data(exclude_directories=excluded_directories)
104
d043b84 @brosner Cleaned up setup.py style
brosner authored
105
15ea3b5 @jezdez Added simple setup.py to package Pinax
jezdez authored
106 setup(
d043b84 @brosner Cleaned up setup.py style
brosner authored
107 name="Pinax",
a4b5788 @jezdez Went back to using setuptools_git given the fact using file_finder di…
jezdez authored
108 version=VERSION,
d043b84 @brosner Cleaned up setup.py style
brosner authored
109 description="Pinax is an open-source collection of re-usable apps for the Django Web Framework",
110 long_description=read("docs", "intro.txt"),
111 author="James Tauber",
112 author_email="jtauber@jtauber.com",
b68f32f @brosner Changed maintainer to myself in setup.py
brosner authored
113 maintainer="Brian Rosner",
114 maintainer_email="brosner@gmail.com",
d043b84 @brosner Cleaned up setup.py style
brosner authored
115 url="http://pinaxproject.com/",
c135004 @brosner Added download_url
brosner authored
116 download_url="http://pinaxproject.com/downloads/",
15ea3b5 @jezdez Added simple setup.py to package Pinax
jezdez authored
117 packages=find_packages(),
d40de56 @jezdez Added find_package_data to setup.py to find package_data instead of u…
jezdez authored
118 package_data=package_data,
15ea3b5 @jezdez Added simple setup.py to package Pinax
jezdez authored
119 zip_safe=False,
bbf6a23 @brosner Created a script entry point for pinax-clone-project which is now ins…
brosner authored
120 entry_points={
d043b84 @brosner Cleaned up setup.py style
brosner authored
121 "console_scripts": [
122 "pinax-admin = pinax.core.management:execute_from_command_line",
bbf6a23 @brosner Created a script entry point for pinax-clone-project which is now ins…
brosner authored
123 ],
124 },
15ea3b5 @jezdez Added simple setup.py to package Pinax
jezdez authored
125 classifiers=[
d043b84 @brosner Cleaned up setup.py style
brosner authored
126 "Development Status :: 4 - Beta",
127 "Environment :: Web Environment",
128 "Intended Audience :: Developers",
129 "License :: OSI Approved :: MIT License",
130 "Operating System :: OS Independent",
131 "Framework :: Django",
132 "Programming Language :: Python",
133 "Programming Language :: Python :: 2.4",
134 "Programming Language :: JavaScript",
15ea3b5 @jezdez Added simple setup.py to package Pinax
jezdez authored
135 ],
136 )
Something went wrong with that request. Please try again.