##// END OF EJS Templates
resourceutil: correct the root path for file based lookup under py2exe...
resourceutil: correct the root path for file based lookup under py2exe This silly copy/paste error caused "Mercurial" to be truncated from "C:\Program Files". The fact that "helptext" and "defaultrc" are now in a subpackage of "mercurial" added it back on, and everything seemed to work. But that broke if not installed to the default directory, and also caused TortoiseHg to look at Mercurial's config files instead of its own. Differential Revision: https://phab.mercurial-scm.org/D8054

File last commit:

r43346:2372284d default
r44677:ccb719dd default
Show More
casesmash.py
41 lines | 934 B | text/x-python | PythonLexer
Pulkit Goyal
casesmash: use absolute_import
r28351 from __future__ import absolute_import
import __builtin__
import os
Augie Fackler
formatting: blacken the codebase...
r43346 from mercurial import util
Matt Mackall
merge with stable
r14730
def lowerwrap(scope, funcname):
f = getattr(scope, funcname)
Augie Fackler
formatting: blacken the codebase...
r43346
Matt Mackall
merge with stable
r14730 def wrap(fname, *args, **kwargs):
d, base = os.path.split(fname)
try:
files = os.listdir(d or '.')
Simon Heimberg
cleanup: drop unused variables and an unused import
r19378 except OSError:
Matt Mackall
merge with stable
r14730 files = []
if base in files:
return f(fname, *args, **kwargs)
for fn in files:
if fn.lower() == base.lower():
return f(os.path.join(d, fn), *args, **kwargs)
return f(fname, *args, **kwargs)
Augie Fackler
formatting: blacken the codebase...
r43346
Matt Mackall
merge with stable
r14730 scope.__dict__[funcname] = wrap
Augie Fackler
formatting: blacken the codebase...
r43346
Matt Mackall
merge with stable
r14730 def normcase(path):
return path.lower()
Augie Fackler
formatting: blacken the codebase...
r43346
Matt Mackall
merge with stable
r14730 os.path.normcase = normcase
for f in 'file open'.split():
lowerwrap(__builtin__, f)
for f in "chmod chown open lstat stat remove unlink".split():
lowerwrap(os, f)
for f in "exists lexists".split():
lowerwrap(os.path, f)
lowerwrap(util, 'posixfile')