Skip to content

Commit 7537cf0

Browse files
committed
Python3 compatibility and dependency management
1 parent 592a7a6 commit 7537cf0

File tree

8 files changed

+23
-14
lines changed

8 files changed

+23
-14
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
*.pyc
22
__pycache__/
3-
build/
3+
build/*.egg-info

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@
2525
license='LGPL',
2626
url='http://seis.bris.ac.uk/~enxjn/xppy',
2727
platforms='All-platforms',
28-
packages=['xppy','xppy.parser','xppy.utils']
28+
packages=['xppy','xppy.parser','xppy.utils'],
29+
install_requires=['numpy', 'matplotlib'],
2930
)

xppy/parser/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from parse import *
2-
from run import *
1+
from .parse import *
2+
from .run import *
33

44
#__all__ = ['ode', 'set', 'run']

xppy/parser/parse.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
2727
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2828
'''
29+
from __future__ import print_function
30+
from __future__ import absolute_import
2931
import os
3032
import numpy as np
3133

@@ -38,7 +40,7 @@ def change_ode(ode_file=tmp_ode, new_pars=[]):
3840
Function changes the parameters and initial conditions specified in
3941
new_pars in given ode_file.
4042
'''
41-
print 'Warning! Function is obsolete, use changeOde instead!'
43+
print('Warning! Function is obsolete, use changeOde instead!')
4244
changeOde(new_pars, ode_file)
4345

4446
def changeOde(new_pars, ode_file=tmp_ode):
@@ -177,7 +179,7 @@ def change_set(set_file, new_pars):
177179
Function changes the parameters and initial conditions specified in
178180
new_pars in given ode_file.
179181
'''
180-
print 'Warning! Function is obsolete, use changeSet instead!'
182+
print('Warning! Function is obsolete, use changeSet instead!')
181183
changeSet(new_pars, set_file)
182184

183185
def changeSet(new_pars, set_file=tmp_set):

xppy/parser/run.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
2727
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2828
'''
29+
from __future__ import print_function
30+
from __future__ import absolute_import
31+
2932
import os
3033
import shutil
3134
from xppy.parser import parse
@@ -39,7 +42,7 @@
3942
def set_cmd(xpp_path):
4043
global c_g
4144
c_g = os.path.join(xpp_path, c_g)
42-
print "XPP Path set: %s" % (c_g,)
45+
print("XPP Path set: %s" % (c_g,))
4346
return c_g
4447

4548
def run(ode_file=tmp_ode, set_file=tmp_set, verbose=False):
@@ -94,7 +97,7 @@ def createTmp(ode_file=None, set_file=None):
9497
if set_file != None:
9598
shutil.copy(set_file, tmp_set)
9699
if ode_file == None and set_file == None:
97-
print 'Warning! No files where created, both ode and set arguments are None.'
100+
print('Warning! No files where created, both ode and set arguments are None.')
98101

99102
def deleteTmp(del_ode=True, del_set=True):
100103
'''

xppy/utils/allutils.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
2727
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2828
'''
29-
from allinfo import *
30-
from data import *
31-
from diagram import *
32-
from solution import *
33-
from output import *
29+
from .allinfo import *
30+
from .data import *
31+
from .diagram import *
32+
from .solution import *
33+
from .output import *

xppy/utils/plot.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
2727
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2828
'''
29+
from __future__ import print_function
30+
from __future__ import absolute_import
31+
2932
import numpy as np #@UnresolvedImport
3033
from xppy.utils import allinfo
3134
import matplotlib.pyplot as pl #@UnresolvedImport

xppy/utils/solution.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
2727
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2828
'''
29-
29+
from __future__ import print_function
3030
import numpy as np #@UnresolvedImport
3131

3232
####

0 commit comments

Comments
 (0)