diff --git a/MANIFEST.in b/MANIFEST.in index 15bb60fc..9c2c6e4a 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -5,5 +5,5 @@ include setup.cfg include MANIFEST.in recursive-include pyraf * recursive-include tools *.py -global-exclude *.pyc *.o +global-exclude *.pyc *.o *.so *.sqlite3 recursive-inclulde docs * diff --git a/README.rst b/README.rst index 2ab6420c..da815e38 100644 --- a/README.rst +++ b/README.rst @@ -29,10 +29,11 @@ The minimal Python required for PyRAF is 3.6, but it is recommended to use the latest available version. An installation in an virtual environment like venv_ or conda_ is possible. -The package can be installed from the Git repository with the command -``pip3 install .``. Note that the package requires a compilation, so -aside from pip3, the C compiler and development libraries -(on Linux ``libx11-dev``) should be installed. +The package can be installed from PyPI_ with the command ``pip3 +install pyraf``. Note that if no binary installation is available on +PyPI, the package requires a compilation, so aside from pip3, the C +compiler and development libraries (on Linux ``libx11-dev``) should be +installed. Contributing Code, Documentation, or Feedback --------------------------------------------- diff --git a/pyraf/GkiMpl.py b/pyraf/GkiMpl.py index 7eb9111f..54b38725 100644 --- a/pyraf/GkiMpl.py +++ b/pyraf/GkiMpl.py @@ -476,7 +476,7 @@ def gki_text(self, arg): # add the text x = gki.ndc(arg[0]) y = gki.ndc(arg[1]) - text = arg[3:].astype(numpy.int8).tobytes().encode('ascii') + text = arg[3:].astype(numpy.int8).tobytes().decode('ascii') ta = self.textAttributes # For now, force this to be non-bold for decent looking plots. It diff --git a/pyraf/MplCanvasAdapter.py b/pyraf/MplCanvasAdapter.py index f11f86b5..6fcac4b8 100644 --- a/pyraf/MplCanvasAdapter.py +++ b/pyraf/MplCanvasAdapter.py @@ -3,7 +3,7 @@ import matplotlib.backends.backend_tkagg as tkagg from .Ptkplot import hideTkCursor from .Ptkplot import FullWindowCursor -import tk +import tkinter from .wutil import moveCursorTo, WUTIL_USING_X @@ -84,9 +84,9 @@ def resize_widget(self, event): self.figure.set_size_inches(winch, hinch, forward=False) self._tkcanvas.delete(self._tkphoto) - self._tkphoto = tk.PhotoImage(master=self._tkcanvas, - width=int(width), - height=int(height)) + self._tkphoto = tkinter.PhotoImage(master=self._tkcanvas, + width=int(width), + height=int(height)) self._tkcanvas.create_image(int(width / 2), int(height / 2), image=self._tkphoto) diff --git a/pyraf/tests/test_core_nongraphics.py b/pyraf/tests/test_core_nongraphics.py index 84014d11..80317a11 100644 --- a/pyraf/tests/test_core_nongraphics.py +++ b/pyraf/tests/test_core_nongraphics.py @@ -32,7 +32,7 @@ def test_subproc_write_readline(_proc): """ _proc.write(b'test string one\n') _proc.write(b'test string two\n') - time.sleep(0.01) + time.sleep(0.1) assert _proc.readline() == b'test string one\n' assert _proc.readline() == b'test string two\n' @@ -44,7 +44,7 @@ def test_subproc_write_readPendingChars(_proc): test_inputs = (b'one', b'two', b'three') for test_input in test_inputs: _proc.write(test_input + b'\n') - time.sleep(0.01) + time.sleep(0.1) expected = tuple(_proc.readPendingChars().splitlines()) assert test_inputs == expected diff --git a/pyraf/tests/test_graphics.py b/pyraf/tests/test_graphics.py index 555fa1fd..66fc4374 100644 --- a/pyraf/tests/test_graphics.py +++ b/pyraf/tests/test_graphics.py @@ -8,6 +8,13 @@ import pytest +try: + host_arch = sys.implementation._multiarch.split("-")[0] +except AttributeError: + import platform + host_arch = platform.machine() +is_i386 = host_arch in ('i386', 'i486', 'i586', 'i686') + from stsci.tools import capable from .utils import HAS_IRAF, DATA_DIR @@ -206,6 +213,7 @@ def test_gki_control_codes(): assert gki.control2name[ctl] == 'control_unknown' +@pytest.mark.skipif(is_i386, reason='diff is not identical on i386') def test_gki_single_prow(): """ Test a prow-plot of a single row from dev$pix to .ps """ iraf.plot(_doprint=0) # load plot for prow @@ -220,6 +228,7 @@ def test_gki_single_prow(): diffit(EXP2IGNORE, psOut, os.path.join(DATA_DIR, PSDEV + "_prow_256.ps")) +@pytest.mark.skipif(is_i386, reason='diff is not identical on i386') def test_gki_prow_1_append(): """ Test a prow-plot with 1 append (2 rows total, dev$pix) to .ps """ iraf.plot(_doprint=0) # load plot for prow @@ -236,6 +245,7 @@ def test_gki_prow_1_append(): PSDEV + "_prow_256_250.ps")) +@pytest.mark.skipif(is_i386, reason='diff is not identical on i386') def test_gki_prow_2_appends(): """ Test a prow-plot with 2 appends (3 rows total, dev$pix) to .ps """ iraf.plot(_doprint=0) # load plot for prow @@ -253,6 +263,7 @@ def test_gki_prow_2_appends(): os.path.join(DATA_DIR, PSDEV + "_prow_256_250_200.ps")) +@pytest.mark.skipif(is_i386, reason='diff is not identical on i386') def test_gki_2_prows_no_append(): """ Test 2 prow calls with no append (2 dev$pix rows) to 2 .ps's """ iraf.plot(_doprint=0) # load plot for prow diff --git a/pyraf/tpar.py b/pyraf/tpar.py index 10996054..0e51c175 100644 --- a/pyraf/tpar.py +++ b/pyraf/tpar.py @@ -21,19 +21,12 @@ # Fake out import of urwid if it fails, to keep tpar from bringing down # all of PyRAF. class FakeModule: - - def __init__(*args, **keys): - pass - + pass class FakeClass: - - def __init__(*args, **keys): - pass + pass -URWID_PRE_9P9 = False - try: import urwid.curses_display import urwid.raw_display @@ -41,10 +34,7 @@ def __init__(*args, **keys): from . import urwutil from . import urwfiledlg urwid.set_encoding("ascii") # gives better performance than 'utf8' - if 0 == urwid.__version__.find('0.9.8') or 0 == urwid.__version__.find( - '0.9.7'): - URWID_PRE_9P9 = True -except Exception as e: +except ImportException as e: urwid = FakeModule() urwid.Edit = FakeClass() urwid.Columns = FakeClass() @@ -715,10 +705,7 @@ def __init__(self, taskName): self.escape = False - if URWID_PRE_9P9: - self._createButtonsOld() - else: - self._createButtons() + self._createButtons() self.colon_edit = PyrafEdit("", "", @@ -749,58 +736,6 @@ def __init__(self, taskName): MODE_KEYS = MODE_KEYS_EMACS Binder.__init__(self, BINDINGS, self.inform, MODE_KEYS) - def _createButtonsOld(self): - """ Set up all the bottom row buttons and their spacings """ - - isPset = isinstance(self.taskObject, iraftask.IrafPset) - - self.help_button = urwid.Padding(urwid.Button("Help", self.HELP), - align="center", - width=('fixed', 8)) - self.cancel_button = urwid.Padding(urwid.Button("Cancel", self.QUIT), - align="center", - width=('fixed', 10)) - if not isPset: - self.save_as_button = urwid.Padding(urwid.Button( - "Save As", self.SAVEAS), - align="center", - width=('fixed', 11)) - self.save_button = urwid.Padding(urwid.Button("Save", self.EXIT), - align="center", - width=('fixed', 8)) - self.exec_button = urwid.Padding(urwid.Button("Exec", self.go), - align="center", - width=('fixed', 8)) - if self.__areAnyToLoad: - self.open_button = urwid.Padding(urwid.Button("Open", self.PFOPEN), - align="center", - width=('fixed', 8)) - - # GUI button layout - weightings - if isPset: # show no Open nor Save As buttons - self.buttons = urwid.Columns([('weight', 0.2, self.exec_button), - ('weight', 0.2, self.save_button), - ('weight', 0.2, self.cancel_button), - ('weight', 0.4, self.help_button)]) - else: - if not self.__areAnyToLoad: # show Save As but not Open - self.buttons = urwid.Columns([ - ('weight', 0.175, self.exec_button), - ('weight', 0.175, self.save_button), - ('weight', 0.175, self.save_as_button), - ('weight', 0.175, self.cancel_button), - ('weight', 0.3, self.help_button) - ]) - else: # show all possible buttons (iterated on this spacing) - self.buttons = urwid.Columns([ - ('weight', 0.20, self.open_button), - ('weight', 0.15, self.exec_button), - ('weight', 0.15, self.save_button), - ('weight', 0.15, self.save_as_button), - ('weight', 0.18, self.cancel_button), - ('weight', 0.20, self.help_button) - ]) - def _createButtons(self): """ Set up all the bottom row buttons and their spacings """ @@ -1397,12 +1332,10 @@ def tpar_option_factory(self, param, defaultParam): def tpar(taskName): if isinstance(urwid, FakeModule): - print( - "The urwid package isn't found on your Python system so tpar can't be used.", - file=sys.stderr) - print(' (the error given: "' + urwid.the_error + '")', - file=sys.stderr) - print("Please install urwid version >= 0.9.7 or use epar instead.", - file=sys.stderr) + print(f''' +The urwid package isn't found on your Python system so tpar can't be used.' + (the error given: "{urwid.the_error}")' +Please install urwid or use epar instead. +''', file=sys.stderr) return TparDisplay(taskName).main() diff --git a/setup.cfg b/setup.cfg index 1b0399bc..8d56b2f3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = pyraf -author = Rick White, Perry Greenfield, Chris Sontag +author = Rick White, Perry Greenfield, Chris Sontag, Ole Streicher url = https://iraf-community.github.io/pyraf.html description = Pythonic interface to IRAF that can be used in place of the existing IRAF CL long_description = file:README.rst