commit ef784165002086cbc5b8131edcde815326a63009 Author: Isis Lovecruft isis@torproject.org Date: Tue Oct 15 03:48:21 2013 +0000
Add get_template_files() function in setup.py for installing web resources.
* ADD ``glob`` dependency to setup.py. * ADD ``get_template_files()`` function to setup.py, which simply globs for filenames which match various directory patterns, in order to obtain files which should be installed for BridgeDB's HTTPS distributor. * FIXES a bug where robots.txt was not being installed as a resource file. --- setup.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
diff --git a/setup.py b/setup.py index 876baa8..143db1d 100644 --- a/setup.py +++ b/setup.py @@ -20,6 +20,8 @@ import os import setuptools import sys
+from glob import glob + # Fix circular dependency with setup.py install try: from babel.messages.frontend import compile_catalog, extract_messages @@ -159,6 +161,26 @@ def get_supported_langs():
return lang_dirs, lang_files
+def get_template_files(): + """Return the paths to any web resource files to include in the package. + + :rtype: list + :returns: Any files in :attr:`repo_templates` which match one of the glob + patterns in :ivar:`include_patterns`. + """ + include_patterns = ['*.html', + '*.txt', + '*.asc', + 'assets/*'] + template_files = [] + + for include_pattern in include_patterns: + pattern = os.path.join(repo_templates, include_pattern) + matches = glob(pattern) + template_files.extend(matches) + + return template_files + def get_data_files(): """Returns our hard-coded data_files which should be distributed.
tor-commits@lists.torproject.org