Skip to content

Commit

Permalink
Fixed a bug that prevented pyminifier from working on Python 2.6. Thi…
Browse files Browse the repository at this point in the history
…s completely solves issue #17
  • Loading branch information
MoshiBin committed Apr 2, 2015
1 parent 92bdf14 commit 168f928
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 17 deletions.
13 changes: 7 additions & 6 deletions pyminifier/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,13 @@

py3 = False
lzma = False
if sys.version_info.major == 3:
py3 = True
try:
import lzma
except ImportError:
pass
if not isinstance(sys.version_info, tuple):
if sys.version_info.major == 3:
py3 = True
try:
import lzma
except ImportError:
pass

# Regexes
multiline_indicator = re.compile('\\\\(\s*#.*)?\n')
Expand Down
13 changes: 7 additions & 6 deletions pyminifier/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@

py3 = False
lzma = False
if sys.version_info.major == 3:
py3 = True
try:
import lzma
except ImportError:
pass
if not isinstance(sys.version_info, tuple):
if sys.version_info.major == 3:
py3 = True
try:
import lzma
except ImportError:
pass

def main():
"""
Expand Down
2 changes: 1 addition & 1 deletion pyminifier/analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# Globals
py3 = False

if not isinstance(sys.version_info.major, tuple):
if not isinstance(sys.version_info, tuple):
if sys.version_info.major == 3:
py3 = True

Expand Down
5 changes: 3 additions & 2 deletions pyminifier/compression.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@
from . import analyze, token_utils, minification, obfuscate

py3 = False
if sys.version_info.major == 3:
py3 = True
if not isinstance(sys.version_info, tuple):
if sys.version_info.major == 3:
py3 = True

def bz2_pack(source):
"""
Expand Down
5 changes: 3 additions & 2 deletions pyminifier/obfuscate.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
from . import analyze
from . import token_utils

if sys.version_info.major == 3:
unichr = chr # So we can support both 2 and 3
if not isinstance(sys.version_info, tuple):
if sys.version_info.major == 3:
unichr = chr # So we can support both 2 and 3

try:
unichr(0x10000) # Will throw a ValueError on narrow Python builds
Expand Down

0 comments on commit 168f928

Please sign in to comment.