diff options
| -rw-r--r-- | .bzrignore | 1 | ||||
| -rw-r--r-- | MANIFEST.in | 1 | ||||
| -rw-r--r-- | setup.py | 12 | ||||
| -rw-r--r-- | setupbzr.py | 32 |
4 files changed, 46 insertions, 0 deletions
diff --git a/.bzrignore b/.bzrignore index 9c3023bfa..d3081d505 100644 --- a/.bzrignore +++ b/.bzrignore @@ -2,5 +2,6 @@ .bzrignore build/ cron/crontab.in +dist/ mailman.egg-info misc/mailman diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 000000000..a28dec7e1 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1 @@ +recursive-include Mailman/messages *.mo @@ -35,8 +35,10 @@ if sys.hexversion < 0x20500f0: # Ensure that all the .mo files are generated from the corresponding .po file. # This procedure needs to be made sane, probably when the language packs are # properly split out. + import os import Mailman.messages + start_dir = os.path.dirname(Mailman.messages.__file__) for dirpath, dirnames, filenames in os.walk(start_dir): for filename in filenames: @@ -78,9 +80,19 @@ Any other spelling is incorrect.""", keywords = 'email', packages = find_packages(), include_package_data = True, + # This doesn't work to include the generated .mo files because they are + # neither maintained under revision control, nor do they live in a Python + # package directory. +## package_data = { +## # Include .mo generated files +## 'Mailman/messages': ['*.mo'], +## }, # Executable scripts entry_points = { 'console_scripts': list(scripts), + 'setuptools.file_finders': [ + 'bzr = setupbzr:find_files_for_bzr', + ], }, # Third-party requirements. install_requires = [ diff --git a/setupbzr.py b/setupbzr.py new file mode 100644 index 000000000..517464b42 --- /dev/null +++ b/setupbzr.py @@ -0,0 +1,32 @@ +# setuptools plugin for bzr +# Barry Warsaw <barry@python.org> + +# Use by adding this to your setuptools.file_finders entry point: +# 'bzr = bzrplug:find_files_for_bzr' + +# http://peak.telecommunity.com/DevCenter/setuptools#adding-support-for-other-revision-control-systems + +import os +import bzrlib.branch + + +def get_children(path): + # Open an existing branch which contains the url. + branch, inpath = bzrlib.branch.Branch.open_containing(path) + # Get the inventory of the branch's last revision. + inv = branch.repository.get_revision_inventory(branch.last_revision()) + # Get the inventory entry for the path. + entry = inv[inv.path2id(path)] + # Return the names of the children. + return [os.path.join(path, child) for child in entry.children.keys()] + + +def find_files_for_bzr(dirname): + bzrfiles = [] + search = [dirname] + while search: + current = search.pop(0) + children = get_children(current) + bzrfiles.extend(children) + search.extend([child for child in children if os.path.isdir(child)]) + return bzrfiles |
