Index: cms/sources.py |
=================================================================== |
--- a/cms/sources.py |
+++ b/cms/sources.py |
@@ -201,17 +201,17 @@ |
def read_include(self, include, format): |
return self.read_file(self.include_filename(include, format)) |
class MercurialSource(Source): |
def __init__(self, repo): |
command = ['hg', '-R', repo, 'archive', '-r', 'default', |
- '-t', 'uzip', '-p', '.', '-'] |
+ '-t', 'uzip', '-p', 'root', '-'] |
data = subprocess.check_output(command) |
self._archive = zipfile.ZipFile(StringIO(data), mode='r') |
command = ['hg', '-R', repo, 'id', '-n', '-r', 'default'] |
self.version = subprocess.check_output(command).strip() |
self._name = os.path.basename(repo.rstrip(os.path.sep)) |
@@ -222,29 +222,29 @@ |
self.close() |
return False |
def close(self): |
self._archive.close() |
def has_file(self, filename): |
try: |
- self._archive.getinfo('./%s' % filename) |
+ self._archive.getinfo('root/' + filename) |
except KeyError: |
return False |
return True |
def read_file(self, filename, binary=False): |
- data = self._archive.read('./%s' % filename) |
+ data = self._archive.read('root/' + filename) |
if not binary: |
data = data.decode('utf-8') |
return (data, '%s!%s' % (self._name, filename)) |
def list_files(self, subdir): |
- prefix = './%s/' % subdir |
+ prefix = 'root/{}/'.format(subdir) |
for filename in self._archive.namelist(): |
if filename.startswith(prefix): |
yield filename[len(prefix):] |
if os.name == 'posix': |
def get_cache_dir(self): |
return '/var/cache/' + self._name |