py2ips.pl: replace setuptools with distribute (in deps)
authorIgor Pashev <igor.pashev@nexenta.com>
Wed, 26 Oct 2011 15:32:52 +0400
changeset 467 7409853656b6
parent 466 c0df6d8c64ab
child 468 ba6c4262c8df
py2ips.pl: replace setuptools with distribute (in deps)
tools/py2ips.pl
--- a/tools/py2ips.pl	Tue Oct 25 18:07:11 2011 +0400
+++ b/tools/py2ips.pl	Wed Oct 26 15:32:52 2011 +0400
@@ -87,13 +87,12 @@
 
 
 
-
 my $pyversion = get_output_line 'python --version 2>&1';
 if ($pyversion =~ /Python +(\d)\.(\d)\..+/) {
     $pyversion = "$1$2";
     blab "Python: $pyversion"
 } else {
-    fatal "Can't parse Python version"
+    fatal "Can't parse Python version: $pyversion"
 }
 
 foreach my $pkg (@ARGV) {
@@ -113,7 +112,7 @@
         fatal "Can't parse archive name: $archive"
     }
 
-    $pkg_name =~ s/_/-/g;
+    $pkg_name =~ s/_/-/g; # _ is not allowed in dpkg names
     my $pkg_name_lc = lc $pkg_name;
     blab "Package name: $pkg_name";
 
@@ -138,7 +137,7 @@
 
 
     my_chdir '../__srcdir__';
-    shell_exec qq!python setup.py install --root=../__destdir__ --prefix=/usr !;
+    shell_exec 'python setup.py install --root=../__destdir__ --prefix=/usr';
 
     # FIXME: versions (kid >= 0.9.6)
     my @pkg_deps = ();
@@ -149,7 +148,11 @@
          @{get_output "cat $pkg_name.egg-info/requires.txt"}
     }
     uniq \@pkg_deps;
-    blab "Dependencies: ", (join ', ', @pkg_deps);
+    if (grep {$_ eq 'setuptools'} @pkg_deps) {
+        @pkg_deps = map {$_ eq 'setuptools' ? 'distribute' : $_} @pkg_deps;
+        warning "Dependencies: 'setuptools' replaced with 'distribute'"
+    }
+    blab 'Dependencies: ', (join ', ', @pkg_deps);
 
     my $pkg_summary = '';
     for my $dir ( ("$pkg_name.egg-info", '.') ) {