[Python-checkins] distutils2: Merge
tarek.ziade
python-checkins at python.org
Wed Feb 16 22:23:57 CET 2011
tarek.ziade pushed b6f8c2fbc3ec to distutils2:
http://hg.python.org/distutils2/rev/b6f8c2fbc3ec
changeset: 1050:b6f8c2fbc3ec
parent: 1049:b437c5373952
parent: 1048:b4c14d0649dd
user: FELD Boris <lothiraldan at gmail.com>
date: Sat Jan 29 16:59:48 2011 +0100
summary:
Merge
files:
diff --git a/distutils2/datafiles.py b/distutils2/datafiles.py
--- a/distutils2/datafiles.py
+++ b/distutils2/datafiles.py
@@ -1,8 +1,8 @@
import os
import re
-from os import path as osp
from glob import iglob as simple_iglob
+__all__ = ['iglob', 'resources_dests']
class SmartGlob(object):
@@ -13,16 +13,16 @@
def expand(self, basepath, destination):
if self.base:
- base = osp.join(basepath, self.base)
+ base = os.path.join(basepath, self.base)
else:
base = basepath
if '*' in base or '{' in base or '}' in base:
raise NotImplementedError('glob are not supported into base part of datafiles definition. %r is an invalide basepath' % base)
- absglob = osp.join(base, self.suffix)
+ absglob = os.path.join(base, self.suffix)
for file in iglob(absglob):
path_suffix = file[len(base):].lstrip('/')
relpath = file[len(basepath):].lstrip('/')
- dest = osp.join(destination, path_suffix)
+ dest = os.path.join(destination, path_suffix)
yield relpath, dest
RICH_GLOB = re.compile(r'\{([^}]*)\}')
@@ -50,7 +50,7 @@
else:
radical = radical.lstrip('/')
for (path, dir, files) in os.walk(prefix):
- for file in iglob(osp.join(prefix, path, radical)):
+ for file in iglob(os.path.join(prefix, path, radical)):
yield os.path.join(prefix, file)
def resources_dests(resources_dir, rules):
diff --git a/distutils2/tests/test_datafiles.py b/distutils2/tests/test_datafiles.py
--- a/distutils2/tests/test_datafiles.py
+++ b/distutils2/tests/test_datafiles.py
@@ -7,7 +7,6 @@
from distutils2.tests import unittest, support, run_unittest
from distutils2.datafiles import resources_dests, RICH_GLOB
import re
-from os import path as osp
@@ -25,9 +24,9 @@
def build_spec(self, spec, clean=True):
tempdir = self.mkdtemp()
for filepath in spec:
- filepath = osp.join(tempdir, *filepath.split('/'))
- dirname = osp.dirname(filepath)
- if dirname and not osp.exists(dirname):
+ filepath = os.path.join(tempdir, *filepath.split('/'))
+ dirname = os.path.dirname(filepath)
+ if dirname and not os.path.exists(dirname):
os.makedirs(dirname)
self.write_file(filepath, 'babar')
if clean:
--
Repository URL: http://hg.python.org/distutils2
More information about the Python-checkins
mailing list