Skip to content

Commit

Permalink
Use Python 3 by default
Browse files Browse the repository at this point in the history
  • Loading branch information
skoolkid committed Jan 12, 2017
1 parent b5f0989 commit 8fa5002
Show file tree
Hide file tree
Showing 19 changed files with 48 additions and 61 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ python:
- 3.5
- 3.6
install:
- if [[ $TRAVIS_PYTHON_VERSION == 2* ]]; then pip install codecov; fi
- if [[ $TRAVIS_PYTHON_VERSION == 3.4* ]]; then pip install codecov; fi
script:
- if [[ $TRAVIS_PYTHON_VERSION == 2* ]]; then make test-cover; else make test; fi
- if [[ $TRAVIS_PYTHON_VERSION == 3.4* ]]; then make test-cover; else make test; fi
after_success:
- if [[ $TRAVIS_PYTHON_VERSION == 2* ]]; then codecov; fi
- if [[ $TRAVIS_PYTHON_VERSION == 3.4* ]]; then codecov; fi
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
NOSETESTS ?= nosetests3
NOSETESTS27 ?= nosetests-2.7
NOSETESTS34 ?= python3.4 /usr/bin/nosetests
NOSETESTS35 ?= $(HOME)/Python/Python3.5/bin/nosetests
Expand All @@ -15,7 +16,7 @@ usage:
@echo " man build the man pages"
@echo " clean clean the documentation and man pages"
@echo " hh build the Hungry Horace disassembly"
@echo " test[-all] run core/all tests with current Python interpreter"
@echo " test[-all] run core/all tests with default Python 3 interpreter"
@echo " test27[-all] run core/all tests with Python 2.7"
@echo " test3X[-all] run core/all tests with Python 3.X (4<=X<=6)"
@echo " test-cover run core tests with coverage info"
Expand Down Expand Up @@ -58,11 +59,11 @@ remove-disassembly-tests:

.PHONY: test
test: remove-disassembly-tests
nosetests -w tests
$(NOSETESTS) -w tests

.PHONY: test-all
test-all: write-disassembly-tests
nosetests -w tests
$(NOSETESTS) -w tests

.PHONY: test%
test%: remove-disassembly-tests
Expand All @@ -74,7 +75,7 @@ test%-all: write-disassembly-tests

.PHONY: test-cover
test-cover: remove-disassembly-tests
nosetests -w tests --with-coverage --cover-package=skoolkit --cover-erase
$(NOSETESTS) -w tests --with-coverage --cover-package=skoolkit --cover-erase

.PHONY: release
release:
Expand Down
5 changes: 2 additions & 3 deletions bin2sna.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/env python3

# Copyright 2016 Richard Dymond (rjdymond@gmail.com)
# Copyright 2016-2017 Richard Dymond (rjdymond@gmail.com)
#
# This file is part of SkoolKit.
#
Expand Down
5 changes: 2 additions & 3 deletions bin2tap.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/env python3

# Copyright 2012-2013 Richard Dymond (rjdymond@gmail.com)
# Copyright 2012-2013, 2017 Richard Dymond (rjdymond@gmail.com)
#
# This file is part of SkoolKit.
#
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/env python3
from distutils.core import setup

from skoolkit import VERSION
Expand Down
5 changes: 2 additions & 3 deletions skool2asm.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/env python3

# Copyright 2012-2013 Richard Dymond (rjdymond@gmail.com)
# Copyright 2012-2013, 2017 Richard Dymond (rjdymond@gmail.com)
#
# This file is part of SkoolKit.
#
Expand Down
5 changes: 2 additions & 3 deletions skool2bin.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/env python3

# Copyright 2015 Richard Dymond (rjdymond@gmail.com)
# Copyright 2015, 2017 Richard Dymond (rjdymond@gmail.com)
#
# This file is part of SkoolKit.
#
Expand Down
5 changes: 2 additions & 3 deletions skool2ctl.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/env python3

# Copyright 2012-2013 Richard Dymond (rjdymond@gmail.com)
# Copyright 2012-2013, 2017 Richard Dymond (rjdymond@gmail.com)
#
# This file is part of SkoolKit.
#
Expand Down
5 changes: 2 additions & 3 deletions skool2html.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/env python3

# Copyright 2012-2013 Richard Dymond (rjdymond@gmail.com)
# Copyright 2012-2013, 2017 Richard Dymond (rjdymond@gmail.com)
#
# This file is part of SkoolKit.
#
Expand Down
5 changes: 2 additions & 3 deletions skool2sft.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/env python3

# Copyright 2011-2013 Richard Dymond (rjdymond@gmail.com)
# Copyright 2011-2013, 2017 Richard Dymond (rjdymond@gmail.com)
#
# This file is part of SkoolKit.
#
Expand Down
12 changes: 6 additions & 6 deletions skoolkit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ def open_file(fname, mode='r'):
if fname == '-':
if 'w' in mode:
if PY3 and 'b' in mode:
return sys.stdout.buffer # pragma: no cover
return sys.stdout
return sys.stdout.buffer
return sys.stdout # pragma: no cover
return sys.stdin
try:
return open(fname, mode)
Expand All @@ -117,13 +117,13 @@ def open_file(fname, mode='r'):
def read_bin_file(fname, size=-1):
if fname == '-':
if PY3:
return sys.stdin.buffer.read(size) # pragma: no cover
return bytearray(sys.stdin.read(size))
return sys.stdin.buffer.read(size)
return bytearray(sys.stdin.read(size)) # pragma: no cover
try:
with open(fname, 'rb') as f:
if PY3:
return f.read(size) # pragma: no cover
return bytearray(f.read(size))
return f.read(size)
return bytearray(f.read(size)) # pragma: no cover
except IOError as e:
if e.errno == 2:
raise SkoolKitError('{0}: file not found'.format(fname))
Expand Down
10 changes: 5 additions & 5 deletions skoolkit/tap2sna.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-

# Copyright 2013, 2015, 2016 Richard Dymond (rjdymond@gmail.com)
# Copyright 2013, 2015-2017 Richard Dymond (rjdymond@gmail.com)
#
# This file is part of SkoolKit.
#
Expand All @@ -24,10 +24,10 @@
import zipfile
try:
from urllib2 import urlopen
from urlparse import urlparse
except ImportError: # pragma: no cover
from urllib.request import urlopen # pragma: no cover
from urllib.parse import urlparse # pragma: no cover
from urlparse import urlparse # pragma: no cover
except ImportError:
from urllib.request import urlopen
from urllib.parse import urlparse

from skoolkit import SkoolKitError, get_int_param, get_word, get_word3, get_dword, open_file, write_line, VERSION
from skoolkit.snapshot import set_z80_registers, set_z80_state, make_z80_ram_block, Z80_REGISTERS
Expand Down
5 changes: 2 additions & 3 deletions sna2img.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/env python3

# Copyright 2016 Richard Dymond (rjdymond@gmail.com)
# Copyright 2016-2017 Richard Dymond (rjdymond@gmail.com)
#
# This file is part of SkoolKit.
#
Expand Down
5 changes: 2 additions & 3 deletions sna2skool.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/env python3

# Copyright 2012-2013 Richard Dymond (rjdymond@gmail.com)
# Copyright 2012-2013, 2017 Richard Dymond (rjdymond@gmail.com)
#
# This file is part of SkoolKit.
#
Expand Down
5 changes: 2 additions & 3 deletions snapinfo.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/env python3

# Copyright 2016 Richard Dymond (rjdymond@gmail.com)
# Copyright 2016-2017 Richard Dymond (rjdymond@gmail.com)
#
# This file is part of SkoolKit.
#
Expand Down
5 changes: 2 additions & 3 deletions snapmod.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/env python3

# Copyright 2016 Richard Dymond (rjdymond@gmail.com)
# Copyright 2016-2017 Richard Dymond (rjdymond@gmail.com)
#
# This file is part of SkoolKit.
#
Expand Down
5 changes: 2 additions & 3 deletions tap2sna.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/env python3

# Copyright 2013 Richard Dymond (rjdymond@gmail.com)
# Copyright 2013, 2017 Richard Dymond (rjdymond@gmail.com)
#
# This file is part of SkoolKit.
#
Expand Down
5 changes: 2 additions & 3 deletions tapinfo.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/env python3

# Copyright 2015 Richard Dymond (rjdymond@gmail.com)
# Copyright 2015, 2017 Richard Dymond (rjdymond@gmail.com)
#
# This file is part of SkoolKit.
#
Expand Down
4 changes: 2 additions & 2 deletions tools/disassembly.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ usage:
@echo " usage show this help"
@echo " html build the HTML disassembly"
@echo " asm build the ASM disassembly"
@echo " test run tests with current Python interpreter"
@echo " test run tests with default Python 3 interpreter"
@echo " test27 run tests with Python 2.7"
@echo " test3X run tests with Python 3.X (4<=X<=6)"
@$(MAKE) -s _targets
Expand Down Expand Up @@ -46,7 +46,7 @@ write-tests:

.PHONY: test
test: write-tests
nosetests -w tests
nosetests3 -w tests

.PHONY: test%
test%: write-tests
Expand Down

0 comments on commit 8fa5002

Please sign in to comment.