Skip to content

Commit bad625d

Browse files
committed
disable import ix which breaks our relative imports and requires cumbersome sed fixes
git-svn-id: svn+ssh://svn.code.sf.net/p/migrid/code/trunk@4868 b75ad72c-e7d7-11dd-a971-7dbc132099af
1 parent 69f9125 commit bad625d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

modernizeall.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838

3939
exclude_dirs = ['state', 'user-projects', 'doc-src',
4040
'MiG-certificates', 'seafile']
41+
# The import fix breaks our relative imports so disable for now
42+
disable_import_fix = True
4143

4244
if __name__ == '__main__':
4345
if len(sys.argv) < 2:
@@ -53,9 +55,11 @@
5355
print('--- ignoring all %s dirs ---' % ', '.join(exclude_dirs))
5456
mime_helper = mimetypes.MimeTypes()
5557
modernize_base = ['python-modernize', '-n', '-w']
58+
if disable_import_fix:
59+
modernize_base += ['-x', 'import']
5660
# NOTE: fix import lines broken by modernize and leave Copyright line alone
57-
sed_rules = ['s/^from .shared/from shared/g',
58-
's/^from . import /import /g']
61+
sed_rules = ['s/from .shared/from shared/g',
62+
's/from . import /import /g']
5963
postprocess_base = ['sed', '-i'] + [';'.join(sed_rules)]
6064
for (root, dirs, files) in os.walk(target):
6165
timestamp = time.time()
@@ -97,6 +101,9 @@
97101
if modernize_retval != 0:
98102
print("ERROR: failed to modernize %s" % rel_path)
99103
continue
104+
# Nothing to fix if import fix is disabled
105+
if disable_import_fix:
106+
continue
100107
# Skip postprocessing unless file actually changed
101108
if timestamp - os.path.getmtime(path) > 0:
102109
continue

0 commit comments

Comments
 (0)