summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorgoodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2003-06-22 23:07:32 +0000
committergoodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2003-06-22 23:07:32 +0000
commit40c179bfbe7502b2e996e72d6e7a735eb4587e9b (patch)
tree8943ee313d5782d401c299b20e5748be7ef8c3fb /setup.py
parent35268ac488831635e492cf6b193950765ce507b9 (diff)
downloaddocutils-40c179bfbe7502b2e996e72d6e7a735eb4587e9b.tar.gz
Thomas Heller showed us a better way
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@1496 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'setup.py')
-rwxr-xr-xsetup.py28
1 files changed, 24 insertions, 4 deletions
diff --git a/setup.py b/setup.py
index 93e869b1c..b45d649aa 100755
--- a/setup.py
+++ b/setup.py
@@ -3,15 +3,17 @@
# Copyright: This file has been placed in the public domain.
import sys
+import os
from distutils.core import setup
+from distutils.command.build_py import build_py
+
def do_setup():
+ kwargs = package_data.copy()
extras = get_extras()
if extras:
- setup(name = 'Extras--IGNORE', # name for tarball
- py_modules = extras,
- package_dir = {'': 'extras'})
- kwargs = package_data.copy()
+ kwargs['py_modules'] = extras
+ kwargs['cmdclass'] = {'build_py': dual_build_py}
if sys.hexversion >= 0x02030000: # Python 2.3
kwargs['classifiers'] = classifiers
dist = setup(**kwargs)
@@ -31,6 +33,7 @@ what-you-see-is-what-you-get plaintext markup syntax.""", # wrap at col 60
'author_email': 'goodger@users.sourceforge.net',
'license': 'public domain, Python, BSD, GPL (see COPYING.txt)',
'platforms': 'OS-independent',
+ 'package_dir': {'docutils': 'docutils', '': 'extras'},
'packages': ['docutils', 'docutils.languages',
'docutils.parsers', 'docutils.parsers.rst',
'docutils.parsers.rst.directives',
@@ -89,5 +92,22 @@ def get_extras():
return extras
+class dual_build_py(build_py):
+
+ """
+ This class allows the distribution of both packages *and* modules with one
+ call to `distutils.core.setup()`. Thanks to Thomas Heller.
+ """
+
+ def run(self):
+ if not self.py_modules and not self.packages:
+ return
+ if self.py_modules:
+ self.build_modules()
+ if self.packages:
+ self.build_packages()
+ self.byte_compile(self.get_outputs(include_bytecode=0))
+
+
if __name__ == '__main__' :
do_setup()