Anonymous avatar Anonymous committed 201fa9f

Fixing mkcfg conversion if no data_files in setup.py

Comments (0)

Files changed (1)

distutils2/mkcfg.py

             data['packages'].extend(dist.packages or [])
             data['modules'].extend(dist.py_modules or [])
             # 2.1 data_files -> resources.
-            if len(dist.data_files) < 2 or isinstance(dist.data_files[1], str):
-                dist.data_files = [('', dist.data_files)]
-            #add tokens in the destination paths
-            vars = {'distribution.name':data['name']}
-            path_tokens = sysconfig.get_paths(vars=vars).items()
-            #sort tokens to use the longest one first
-            path_tokens.sort(cmp=lambda x,y: cmp(len(y), len(x)),
-                             key=lambda x: x[1])
-            for dest, srcs in (dist.data_files or []):
-                dest = os.path.join(sys.prefix, dest)
-                for tok, path in path_tokens:
-                    if dest.startswith(path):
-                        dest = ('{%s}' % tok) + dest[len(path):]
-                        files = [('/ '.join(src.rsplit('/', 1)), dest) 
-                                 for src in srcs]
-                        data['resources'].extend(files)
-                        continue
+            if dist.data_files:
+                if len(dist.data_files) < 2 or \
+                   isinstance(dist.data_files[1], str):
+                    dist.data_files = [('', dist.data_files)]
+                #add tokens in the destination paths
+                vars = {'distribution.name':data['name']}
+                path_tokens = sysconfig.get_paths(vars=vars).items()
+                #sort tokens to use the longest one first
+                path_tokens.sort(cmp=lambda x,y: cmp(len(y), len(x)),
+                                 key=lambda x: x[1])
+                for dest, srcs in (dist.data_files or []):
+                    dest = os.path.join(sys.prefix, dest)
+                    for tok, path in path_tokens:
+                        if dest.startswith(path):
+                            dest = ('{%s}' % tok) + dest[len(path):]
+                            files = [('/ '.join(src.rsplit('/', 1)), dest) 
+                                     for src in srcs]
+                            data['resources'].extend(files)
+                            continue
             # 2.2 package_data -> extra_files
             package_dirs = dist.package_dir or {}
             for package, extras in dist.package_data.iteritems() or []:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.