Closed stephane-martin closed 7 years ago
Hmm, can we make this more generic so it doesn't have to be listed for every module? Maybe realms/modules/*/templates/*
or something. I think also we might need to add the static directories for the modules in there as well.
@gazpachoking I'm not sure if your example will work. Something like realms/modules *.html
might
Actually I think it does work, but the only way to know is to test or read pip/_vendor/distlib/manifest.py
code (pain occurs), as python packaging doc is quite incomplete.
elif action == 'recursive-include':
for pattern in patterns:
if not self._include_pattern(pattern, prefix=thedir):
logger.warning('no files found matching %r '
'under directory %r', pattern, thedir)
then
pattern_re = self._translate_pattern(pattern, anchor, prefix, is_regex)
then
prefix_re = self._glob_to_re(prefix)[:-len(empty_pattern)]
then this masterwork
def _glob_to_re(self, pattern):
"""Translate a shell-like glob pattern to a regular expression.
Return a string containing the regex. Differs from
'fnmatch.translate()' in that '*' does not match "special characters"
(which are platform-specific).
"""
pattern_re = fnmatch.translate(pattern)
# '?' and '*' in the glob pattern become '.' and '.*' in the RE, which
# IMHO is wrong -- '?' and '*' aren't supposed to match slash in Unix,
# and by extension they shouldn't match such "special characters" under
# any OS. So change all non-escaped dots in the RE to match any
# character except the special characters (currently: just os.sep).
sep = os.sep
if os.sep == '\\':
# we're using a regex to manipulate a regex, so we need
# to escape the backslash twice
sep = r'\\\\'
escaped = r'\1[^%s]' % sep
pattern_re = re.sub(r'((?<!\\)(\\\\)*)\.', escaped, pattern_re)
return pattern_re
(Urrrrggghhh)
So it should work :)
Hello,
install via pip seems broken.
... gives in browser the exception:
TemplateNotFound: wiki/page.html"
Looks like MANIFEST.in is missing paths to templates insides modules...