Skip to content
Permalink
Browse files

2to3:

* drop libpasteurize.fixes.fix_division
* replace lib2to3.fixes.fix_import with libfuturize.fixes.fix_absolute_import (with PyQt exclude plus AlgorithmsTestBase)
* drop lib2to3.fixes.fix_print (replaced with libfuturize.fixes.fix_print_with_import)
  • Loading branch information
jef-n committed Mar 23, 2016
1 parent f197b7c commit 45c9ea2355d8cbd89598f62766bb73be075a2a32
@@ -2,7 +2,7 @@
use strict;
use warnings;

for my $fix (qw/
my @fixes = qw/
lib2to3.fixes.fix_apply
lib2to3.fixes.fix_basestring
lib2to3.fixes.fix_dict
@@ -40,7 +40,6 @@
lib2to3.fixes.fix_xreadlines
lib2to3.fixes.fix_zip
libfuturize.fixes.fix_absolute_import
libfuturize.fixes.fix_cmp
libfuturize.fixes.fix_execfile
libfuturize.fixes.fix_future_builtins
@@ -52,12 +51,16 @@
libfuturize.fixes.fix_print_with_import
libfuturize.fixes.fix_raise
libfuturize.fixes.fix_xrange_with_import
libpasteurize.fixes.fix_division
libpasteurize.fixes.fix_newstyle
/) {
/;

my %files;
for my $filename (glob "scripts/qgis_fixes/fix_*.py") {
$files{$filename}=1;
}

for my $fix (@fixes) {
my($f) = $fix =~ /\.(fix_.*)$/;
next if -f "scripts/qgis_fixes/$f.py";

my $p = $fix;
$p =~ s#\.#/#g;
@@ -69,8 +72,25 @@
}
close F;

print "$p.py => scripts/qgis_fixes/$f.py\n";
open F, ">scripts/qgis_fixes/$f.py";
print F "from $fix import $c\n";
close F;
my $filename = "scripts/qgis_fixes/$f.py";
my $content = "from $fix import $c\n";
delete $files{$filename};

#print "CHECK $filename: $content";

if(-f $filename) {
open F, $filename;
my $f = <F>;
close F;

print "WRONG $filename:\n FOUND:$f EXPECTED:$f" if $f ne $content;
} else {
print "WRITE $filename: $content";

open F, ">$filename";
print F $content;
close F;
}
}

print "LOCAL FIXES:\n ", join( "\n ", keys %files), "\n";
@@ -1 +1,10 @@
from libfuturize.fixes.fix_absolute_import import FixAbsoluteImport
from libfuturize.fixes.fix_absolute_import import FixAbsoluteImport as FixAbsoluteImportOrig

class FixAbsoluteImport(FixAbsoluteImportOrig):

def probably_a_local_import(self, imp_name):
if imp_name.startswith(u"PyQt"):
return False
if imp_name == "AlgorithmsTestBase":
return False
return super(FixAbsoluteImport, self).probably_a_local_import(imp_name)

This file was deleted.

This file was deleted.

This file was deleted.

@@ -374,7 +374,7 @@

def build_pattern():
bare = set()
for old_module, changes in MAPPING.items():
for old_module, changes in list(MAPPING.items()):
for change in changes:
new_module, members = change
members = alternates(members)
@@ -32,7 +32,7 @@ def transform(self, node, results):
else:
first = imp
if isinstance(imp, Node):
first = imp.leaves().next()
first = next(imp.leaves())

if not isinstance(first, Leaf):
return

0 comments on commit 45c9ea2

Please sign in to comment.
You can’t perform that action at this time.