From 924fa05ae1e3b3759a7f2caa4b5d13a01e2b7977 Mon Sep 17 00:00:00 2001 From: "Michael Hirsch, Ph.D" Date: Mon, 20 Mar 2017 13:30:45 -0400 Subject: [PATCH 1/2] 2to3 --- hashpy/tests/test_dbhash.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hashpy/tests/test_dbhash.py b/hashpy/tests/test_dbhash.py index a558c20..0a84f67 100755 --- a/hashpy/tests/test_dbhash.py +++ b/hashpy/tests/test_dbhash.py @@ -53,7 +53,7 @@ def dbhash_run(dbname, orid=None, pf=None): try: hp.driver2(check_for_maximum_gap_size=False) except HashError as e: - print "Failed! " + e.message + print("Failed! " + e.message) except: raise @@ -115,7 +115,7 @@ def save_plot_to_db(fmplotter, dbname=args.dbout, dump_bitmap=args.image): p = FocalMechPlotter(ev, save=save_plot_to_db) else: # quick orid/strike/dip/rake line - print hp.output() + print(hp.output()) p = 0 if args.dbout: db = hp.output(format="ANTELOPE", dbout=args.dbout) @@ -128,4 +128,4 @@ def save_plot_to_db(fmplotter, dbname=args.dbout, dump_bitmap=args.image): import time t0 = time.time() ret = main() - print time.time() - t0 + print(time.time() - t0) From 37bdb5dfc10bc2183c91f23399a4ba165f7c28ca Mon Sep 17 00:00:00 2001 From: "Michael Hirsch, Ph.D" Date: Mon, 20 Mar 2017 13:41:51 -0400 Subject: [PATCH 2/2] correct import method, cross-platform --- .gitignore | 1 + hashpy/__init__.py | 4 ++-- hashpy/hashpype.py | 4 ++-- hashpy/tests/test_hashpype.py | 2 +- setup.py | 1 + 5 files changed, 7 insertions(+), 5 deletions(-) mode change 100644 => 100755 hashpy/tests/test_hashpype.py diff --git a/.gitignore b/.gitignore index 32a4cb9..72c6cec 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +unittest RELEASE-VERSION *DS_Store *.pyc diff --git a/hashpy/__init__.py b/hashpy/__init__.py index 4aa71b0..8ed14c8 100644 --- a/hashpy/__init__.py +++ b/hashpy/__init__.py @@ -10,8 +10,8 @@ """ -from hashpype import HashPype, HashError -from doublecouple import DoubleCouple +from .hashpype import HashPype, HashError +from .doublecouple import DoubleCouple __version__ = "0.5.6" diff --git a/hashpy/hashpype.py b/hashpy/hashpype.py index aaf2bde..8b30d2e 100644 --- a/hashpy/hashpype.py +++ b/hashpy/hashpype.py @@ -15,7 +15,7 @@ using this version of HASH. """ import os -from pwd import getpwuid +from getpass import getuser import numpy as np @@ -262,7 +262,7 @@ def __init__(self, **kwargs): self.esaz = np.empty(npick0, float) self.arid = np.empty(npick0, int) * 0 - self.author = getpwuid(os.getuid()).pw_name + self.author = getuser() if kwargs: self.__dict__.update(kwargs) diff --git a/hashpy/tests/test_hashpype.py b/hashpy/tests/test_hashpype.py old mode 100644 new mode 100755 index 2fe438f..35ec218 --- a/hashpy/tests/test_hashpype.py +++ b/hashpy/tests/test_hashpype.py @@ -1,4 +1,4 @@ -#/usr/bin/env python +#!/usr/bin/env python # # test_hashpype.py -MCW 2013 # diff --git a/setup.py b/setup.py index 18f3452..8586a77 100644 --- a/setup.py +++ b/setup.py @@ -4,6 +4,7 @@ import sys import os import inspect +import setuptools #enables develop from numpy.distutils.core import setup, Extension