Commit 93dec89e authored by Ole Streicher's avatar Ole Streicher

Upstream version 2.1.3

parent 8b6d61e5
......@@ -4,4 +4,5 @@ recursive-include data/clcache *
recursive-include docs pyraf_tutorial.pdf pyraf_tutorial.ps.gz pyraf_install_src.ps pyraf_install_src.pdf
recursive-include lib *
recursive-include src *.h *.c
recursive-include tools *.py
\ No newline at end of file
recursive-include tools *.py
recursive-include required_pkgs *
Metadata-Version: 1.1
Name: pyraf
Version: 2.1.3
Summary: Provides a Pythonic interface to IRAF that can be used in place of
the existing IRAF CL
Home-page: http://www.stsci.edu/resources/software_hardware/pyraf
Author: Rick White, Perry Greenfield
Author-email: help@stsci.edu
License: UNKNOWN
Description: PyRAF is a command language for IRAF based on the Python scripting language
that can be used in place of the existing IRAF CL.
For more information on PyRAF - release notes, installation instructions,
the FAQ, tutorials and other documentation, etc. - please visit:
http://www.stsci.edu/resources/software_hardware/pyraf
If you are in a great hurry and are installing a stand-alone PyRAF download,
visit:
http://www.stsci.edu/resources/software_hardware/pyraf/pyraf_install_src.html
Platform: UNKNOWN
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Topic :: Scientific/Engineering :: Astronomy
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Metadata-Version: 1.1
Name: pyraf
Version: 2.1.3
Summary: Provides a Pythonic interface to IRAF that can be used in place of
the existing IRAF CL
Home-page: http://www.stsci.edu/resources/software_hardware/pyraf
Author: Rick White, Perry Greenfield
Author-email: help@stsci.edu
License: UNKNOWN
Description: PyRAF is a command language for IRAF based on the Python scripting language
that can be used in place of the existing IRAF CL.
For more information on PyRAF - release notes, installation instructions,
the FAQ, tutorials and other documentation, etc. - please visit:
http://www.stsci.edu/resources/software_hardware/pyraf
If you are in a great hurry and are installing a stand-alone PyRAF download,
visit:
http://www.stsci.edu/resources/software_hardware/pyraf/pyraf_install_src.html
Platform: UNKNOWN
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Topic :: Scientific/Engineering :: Astronomy
Classifier: Topic :: Software Development :: Libraries :: Python Modules
This diff is collapsed.
stsci.tools
\ No newline at end of file
......@@ -4,16 +4,21 @@
Checks sys.argv[0] == 'pyraf' to determine whether IRAF initialization
is done verbosely or quietly.
$Id: __init__.py 1983 2013-05-22 15:39:45Z sontag $
$Id: __init__.py 2020 2013-07-25 16:26:33Z sontag $
R. White, 2000 February 18
"""
from __future__ import division # confidence high
__version__ = "2.1"
from .version import *
import os, sys, __main__
# dev only: add revision number if possible (if not done yet)
if __version__.endswith('dev') and len(__svn_revision__) > 0 and \
__svn_revision__[0].isdigit():
__version__ = __version__+__svn_revision__
# Dump version and exit here, if requested
if '-V' in sys.argv or '--version' in sys.argv:
print __version__
......
......@@ -2,7 +2,7 @@
not possible in Tkinter. In general, an attempt is made to use the Pyobjc
bridging package so that compiling another C extension is not needed.
$Id: aqutil.py 1699 2012-04-19 17:45:35Z sontag $
$Id: aqutil.py 1989 2013-05-29 19:59:47Z sontag $
"""
from __future__ import division # confidence high
......@@ -158,6 +158,11 @@ def __doPyobjcWinInit():
""" Initialize the Pyobjc bridging and make some calls to get our PSN and
the parent terminal's PSN. Do only ONCE per process. """
# for #108, also see
# http://www.fruitstandsoftware.com/blog/2012/08/quick-and-easy-debugging-of-unrecognized-selector-sent-to-instance/
# and
# http://www.raywenderlich.com/10209/my-app-crashed-now-what-part-1
global __thisPSN, __termPSN, __screenHeight, __initialized, __objcReqsVoids
# Guard against accidental second calls
if __initialized: return
......
......@@ -5,7 +5,7 @@ The first version of this will be under-representative of the total
functionality, but tests will be added over time, as code issues are
researched and addressed.
$Id: gki_psikern_tests.py 1867 2012-11-26 15:38:24Z sontag $
$Id: gki_psikern_tests.py 1968 2013-04-30 18:58:26Z sontag $
"""
from __future__ import division # confidence high
......@@ -244,14 +244,16 @@ def run_all():
func()
ran += 1
PSDEV = 'psdump'
EXP2IGNORE = '(NOAO/IRAF '
for t in tsts:
preTestCleanup()
func = eval(t)
print PSDEV, ':', func.__doc__.strip()
func()
ran += 1
# this test (use of psdump kernel) is too temperamental on Linux
if not sys.platform.lower().startswith('linux'):
PSDEV = 'psdump'
EXP2IGNORE = '(NOAO/IRAF '
for t in tsts:
preTestCleanup()
func = eval(t)
print PSDEV, ':', func.__doc__.strip()
func()
ran += 1
# If we get here with no exception, we have passed all of the tests
print "\nSuccessfully passed "+str(ran)+" tests"
......
"""irafexecute.py: Functions to execute IRAF connected subprocesses
$Id: irafexecute.py 1935 2013-02-26 16:41:36Z sontag $
$Id: irafexecute.py 1976 2013-05-13 17:27:36Z sontag $
"""
from __future__ import division # confidence high
......@@ -412,6 +412,7 @@ class IrafProcess:
self.stdinIsatty = 0
self.stdoutIsatty = 0
self.envVarList = []
self.par_set_msg_buf = ''
def initialize(self, envdict):
......@@ -627,6 +628,7 @@ class IrafProcess:
par_get = self.par_get
par_set = self.par_set
executeClCommand = self.executeClCommand
while 1:
# each read may return multiple lines; only
......@@ -650,15 +652,44 @@ class IrafProcess:
else:
# pattern match to see what this message is
mcmd = re_match(msg)
if mcmd is None:
# assume each par_set msg ends with either a 'bye' line or with a par_get line
if (mcmd and mcmd.group('par_set')) or len(self.par_set_msg_buf) > 0:
# enter this section if we got a par_set, OR if we are in the
# middle of a par_set coming in multiple msgs...
msg_last_line = msg.strip().split('\n')[-1]
# either way, first line of msg is a par_set, since our re matched,
# but check the LAST line to see if this is the end
if msg_last_line == 'bye' or msg_last_line.startswith('='):
# we have the whole msg now (or maybe did in 1st shot)
# L.log('FULL matched (ps):\n'+('='*60+'\n')+msg+'\n'+('='*60))
if len(self.par_set_msg_buf) > 0:
# is final part of a msg that came in parts
self.par_set_msg_buf += msg
mcmd = re_match(self.par_set_msg_buf)
par_set(mcmd)
self.par_set_msg_buf = '' # flag to not wait for more
self.msg = 'bye\n'
else:
# is a normal par_set that came all in one shot
par_set(mcmd)
else:
# We only have a partial message here, so don't
# do any par_set-ing until we have the whole msg
# L.log('PARTIAL matched (ps):\n'+('='*60+'\n')+msg+'\n'+('='*60))
self.par_set_msg_buf += msg
# empty self.msg to trigger us to read more
self.msg = ''
elif mcmd and mcmd.group('par_get'):
# L.log('matched (pg):\n'+('='*60+'\n')+msg+'\n'+('='*60))
par_get(mcmd)
elif mcmd is None:
# L.log('NO match!:\n'+('='*60+'\n')+msg+'\n'+('='*60))
# Could be any legal CL command.
executeClCommand()
elif mcmd.group('par_get'):
par_get(mcmd)
elif mcmd.group('par_set'):
par_set(mcmd)
else:
# should never get here
# L.log("Program bug: uninterpreted message: " + msg)
raise RuntimeError("Program bug: uninterpreted message `%s'"
% (msg,))
......
......@@ -10,7 +10,7 @@ The exception is that iraffunctions can be used directly for modules
that must be compiled and executed early, before the pyraf module
initialization is complete.
$Id: iraffunctions.py 1771 2012-06-08 22:57:48Z sontag $
$Id: iraffunctions.py 2012 2013-07-24 19:27:52Z stsci_sienkiew $
R. White, 2000 January 20
"""
......@@ -2345,7 +2345,6 @@ def prcache(*args):
@handleRedirAndSaveKwds
def gflush():
"""Flush any buffered graphics output."""
import gki
gki.kernel.flush()
@handleRedirAndSaveKwdsPlus
......@@ -2608,14 +2607,16 @@ def task(*args, **kw):
(fd, tmpCl) = _tempfile.mkstemp(suffix=".cl", prefix=str(s)+'_',
dir=userIrafHome, text=True)
_os.close(fd)
# check for invalid chars as far as python function names go.
# Check basename for invalid chars as far as python func. names go.
# yes this goes against the use of mkstemp from a purity point
# of view but it can't much be helped
tmpClorig = tmpCl
tmpCl = tmpCl.replace('-','_')
tmpCl = tmpCl.replace('+','_')
assert tmpClorig == tmpCl or not _os.path.exists(tmpCl), \
'Abused mkstemp fname: '+tmpCl
# of view but it can't much be helped. verify later is it unique
orig_tmpCl = tmpCl
tmpClPath, tmpClFname = _os.path.split(tmpCl)
tmpClFname = tmpClFname.replace('-','_')
tmpClFname = tmpClFname.replace('+','_')
tmpCl = _os.path.join(tmpClPath, tmpClFname)
assert tmpCl == orig_tmpCl or not _os.path.exists(tmpCl), \
'Abused mkstemp usage in some way; fname: '+tmpCl
# write inline code to .cl file; len(kw) is checked below
f = open(tmpCl, 'w')
f.write(value+'\n')
......
"""irafpar.py -- parse IRAF .par files and create lists of IrafPar objects
$Id: irafpar.py 1935 2013-02-26 16:41:36Z sontag $
$Id: irafpar.py 1958 2013-04-08 21:08:11Z sontag $
R. White, 2000 January 7
"""
......@@ -730,7 +730,7 @@ class IrafParList(taskpars.TaskPars):
def getParObjects(self, param):
"""
Returns _all_ IrafPar objects matching the name given (param),
Returns _all_ IrafPar objects matching the string name given (param),
in the form of a dict like:
{ scopename : <IrafPar instance>, ... }
where scope is '' if the par was found as a regular par in this list,
......@@ -764,14 +764,15 @@ class IrafParList(taskpars.TaskPars):
# There is a PSET in here somewhere...
allpsets = [p for p in self.__pars if isinstance(p, IrafParPset)]
for pset in allpsets:
# Search its pars. We definitely do NOT want a copy,
# Search the pset's pars. We definitely do NOT want a copy,
# we need the originals to edit.
its_plist = pset.get().getParList(docopy=0)
# might need to change next line to use minmatch dict
matching_pars = [pp for pp in its_plist if pp.name.startswith(param)]
its_task = pset.get()
its_plist = its_task.getParList(docopy=0)
# assume full paramname given (no min-matching inside of PSETs)
matching_pars = [pp for pp in its_plist if pp.name == param]
if len(matching_pars) > 1:
raise RuntimeError('Unexpected multiple matches for par: '+ \
param+', are: '+str(matching_pars))
param+', are: '+str([p.name for p in matching_pars]))
# add it to outgoing dict
if len(matching_pars) > 0:
retval[pset.name] = matching_pars[0]
......
__svn_version__ = "1983"
__full_svn_info__ = ""
__setup_datetime__ = "Wed May 22 11:42:28 EDT 2013"
"""This is an automatically generated file created by stsci.distutils.hooks.version_setup_hook.
Do not modify this file by hand.
"""
__all__ = ['__version__', '__vdate__', '__svn_revision__', '__svn_full_info__',
'__setup_datetime__']
import datetime
__version__ = '2.1.3'
__vdate__ = 'unspecified'
__svn_revision__ = "2047"
__svn_full_info__ = 'unknown'
__setup_datetime__ = datetime.datetime(2013, 8, 20, 12, 26, 1, 837603)
# what version of stsci.distutils created this version.py
stsci_distutils_version = '0.3.5.dev'
if '.dev' in __version__:
def update_svn_info():
"""Update the SVN info if running out of an SVN working copy."""
import os
import string
import subprocess
global __svn_revision__
global __svn_full_info__
path = os.path.abspath(os.path.dirname(__file__))
run_svnversion = True
try:
pipe = subprocess.Popen(['svn', 'info', path],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
if pipe.wait() == 0:
lines = []
for line in pipe.stdout.readlines():
line = line.decode('latin1').strip()
if not line:
continue
lines.append(line)
if not lines:
__svn_full_info__ = ['unknown']
else:
__svn_full_info__ = lines
else:
run_svnversion = False
except OSError:
run_svnversion = False
if run_svnversion:
# If updating the __svn_full_info__ succeeded then use its output
# to find the base of the working copy and use svnversion to get
# the svn revision.
for line in __svn_full_info__:
if line.startswith('Working Copy Root Path'):
path = line.split(':', 1)[1].strip()
break
try:
pipe = subprocess.Popen(['svnversion', path],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
if pipe.wait() == 0:
stdout = pipe.stdout.read().decode('latin1').strip()
if stdout and stdout[0] in string.digits:
__svn_revision__ = "2047"
except OSError:
pass
# Convert __svn_full_info__ back to a string
if isinstance(__svn_full_info__, list):
__svn_full_info__ = '\n'.join(__svn_full_info__)
#update_svn_info()
del update_svn_info
"""This is an automatically generated file created by stsci.distutils.hooks.version_setup_hook.
Do not modify this file by hand.
"""
__all__ = ['__version__', '__vdate__', '__svn_revision__', '__svn_full_info__',
'__setup_datetime__']
import datetime
__version__ = '2.1.3'
__vdate__ = 'unspecified'
__svn_revision__ = 'Unable to determine SVN revision'
__svn_full_info__ = 'unknown'
__setup_datetime__ = datetime.datetime(2013, 8, 20, 12, 25, 53, 933220)
# what version of stsci.distutils created this version.py
stsci_distutils_version = '0.3.5.dev'
if '.dev' in __version__:
def update_svn_info():
"""Update the SVN info if running out of an SVN working copy."""
import os
import string
import subprocess
global __svn_revision__
global __svn_full_info__
path = os.path.abspath(os.path.dirname(__file__))
run_svnversion = True
try:
pipe = subprocess.Popen(['svn', 'info', path],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
if pipe.wait() == 0:
lines = []
for line in pipe.stdout.readlines():
line = line.decode('latin1').strip()
if not line:
continue
lines.append(line)
if not lines:
__svn_full_info__ = ['unknown']
else:
__svn_full_info__ = lines
else:
run_svnversion = False
except OSError:
run_svnversion = False
if run_svnversion:
# If updating the __svn_full_info__ succeeded then use its output
# to find the base of the working copy and use svnversion to get
# the svn revision.
for line in __svn_full_info__:
if line.startswith('Working Copy Root Path'):
path = line.split(':', 1)[1].strip()
break
try:
pipe = subprocess.Popen(['svnversion', path],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
if pipe.wait() == 0:
stdout = pipe.stdout.read().decode('latin1').strip()
if stdout and stdout[0] in string.digits:
__svn_revision__ = stdout
except OSError:
pass
# Convert __svn_full_info__ back to a string
if isinstance(__svn_full_info__, list):
__svn_full_info__ = '\n'.join(__svn_full_info__)
update_svn_info()
del update_svn_info
"""This is an automatically generated file created by stsci.distutils.hooks.version_setup_hook.
Do not modify this file by hand.
"""
__all__ = ['__version__', '__vdate__', '__svn_revision__', '__svn_full_info__',
'__setup_datetime__']
import datetime
__version__ = '2.1.3'
__vdate__ = 'unspecified'
__svn_revision__ = 'Unable to determine SVN revision'
__svn_full_info__ = 'unknown'
__setup_datetime__ = datetime.datetime(2013, 8, 20, 12, 25, 53, 933220)
# what version of stsci.distutils created this version.py
stsci_distutils_version = '0.3.5.dev'
if '.dev' in __version__:
def update_svn_info():
"""Update the SVN info if running out of an SVN working copy."""
import os
import string
import subprocess
global __svn_revision__
global __svn_full_info__
path = os.path.abspath(os.path.dirname(__file__))
run_svnversion = True
try:
pipe = subprocess.Popen(['svn', 'info', path],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
if pipe.wait() == 0:
lines = []
for line in pipe.stdout.readlines():
line = line.decode('latin1').strip()
if not line:
continue
lines.append(line)
if not lines:
__svn_full_info__ = ['unknown']
else:
__svn_full_info__ = lines
else:
run_svnversion = False
except OSError:
run_svnversion = False
if run_svnversion:
# If updating the __svn_full_info__ succeeded then use its output
# to find the base of the working copy and use svnversion to get
# the svn revision.
for line in __svn_full_info__:
if line.startswith('Working Copy Root Path'):
path = line.split(':', 1)[1].strip()
break
try:
pipe = subprocess.Popen(['svnversion', path],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
if pipe.wait() == 0:
stdout = pipe.stdout.read().decode('latin1').strip()
if stdout and stdout[0] in string.digits:
__svn_revision__ = stdout
except OSError:
pass
# Convert __svn_full_info__ back to a string
if isinstance(__svn_full_info__, list):
__svn_full_info__ = '\n'.join(__svn_full_info__)
#update_svn_info()
del update_svn_info
......@@ -4,7 +4,7 @@ These are python stubs that are overloaded by a c version implementations.
If the c versions do not exist, then these routines will do nothing
$Id: wutil.py 1793 2012-07-10 15:49:32Z sontag $
$Id: wutil.py 2039 2013-08-05 21:23:13Z sontag $
"""
from __future__ import division # confidence high
......@@ -494,25 +494,71 @@ terminal = TerminalFocusEntity()
focusController = FocusController(terminal)
# debug helper
def dumpspecs():
def dumpspecs(outstream = None, skip_volatiles = False):
""" Dump various flags, settings, values to the terminal. This is not to
be used internal to this module - it must wait until the module is fully
imported for all the values to be finalized. """
print "platform = "+str(sys.platform)
print "PY3K = "+str(capable.PY3K)
print "c.OF_GRAPHICS = "+str(capable.OF_GRAPHICS)
if not capable.OF_GRAPHICS: return
print "TclVersion = "+str(capable.Tkinter.TclVersion)
print "TkVersion = "+str(capable.Tkinter.TkVersion)
print "is_darwin_and_x = "+str(capable.is_darwin_and_x())
print "which_darwin_linkage = "+str(capable.which_darwin_linkage())
print "WUTIL_ON_MAC = "+str(WUTIL_ON_MAC)
print "WUTIL_ON_WIN = "+str(WUTIL_ON_WIN)
print "WUTIL_USING_X = "+str(WUTIL_USING_X)
print "skipDisplay = "+str(_skipDisplay)
print "hasGraphics = "+str(hasGraphics)
print "hasAqua = "+str(_hasAqua)
print "hasXWin = "+str(_hasXWin)
imported for all the values to be finalized. If outstream is not given,
this will simply dump to sys.stdout. """
pyrver = 'unknown'
try:
from pyraf import __version__ as pyrver
except:
pass
out = "python exec = "+str(sys.executable)
out += "\npython ver = "+str(sys.version)
out += "\nplatform = "+str(sys.platform)
if not skip_volatiles:
out += "\nPyRAF ver = "+pyrver
out += "\nPY3K = "+str(capable.PY3K)
out += "\nc.OF_GRAPHICS = "+str(capable.OF_GRAPHICS)
if capable.OF_GRAPHICS:
out += "\nTclVersion = "+str(capable.Tkinter.TclVersion)
out += "\nTkVersion = "+str(capable.Tkinter.TkVersion)
out += "\nWUTIL_ON_MAC = "+str(WUTIL_ON_MAC)
out += "\nWUTIL_ON_WIN = "+str(WUTIL_ON_WIN)
out += "\nWUTIL_USING_X = "+str(WUTIL_USING_X)
out += "\nis_darwin_and_x = "+str(capable.is_darwin_and_x())
if WUTIL_ON_MAC:
out += "\nwhich_darwin_linkage = "+str(capable.which_darwin_linkage())
else:
out += "\nwhich_darwin_linkage = (not darwin)"
out += "\nskipDisplay = "+str(_skipDisplay)
out += "\nhasGraphics = "+str(hasGraphics)
out += "\nhasAqua = "+str(_hasAqua)
out += "\nhasXWin = "+str(_hasXWin)
if 'PYRAFGRAPHICS' in os.environ:
val = os.environ['PYRAFGRAPHICS']
out += "\nPYRAFGRAPHICS = "+val
if val == "matplotlib":
mpl_ok = False
try:
import matplotlib as mpl
mpl_ok = True
except:
out += "\nCannot import matplotlib"
if mpl_ok:
if hasattr(mpl, 'tk_window_focus'):
out += "\nmpl.tk_window_focus = "+str(mpl.tk_window_focus())
else:
out += "\nmpl.tk_window_focus = function not supported"
mpldir = os.path.split(mpl.__file__)[0]
import glob
flist = glob.glob(mpldir+os.path.sep+'backends'+os.path.sep+'*.so')
flist = [os.path.split(f)[1] for f in flist]
out += "\nmpl backends = "+str(flist)
tkaggbknd = mpldir+'/backends/_tkagg.so'
if os.path.exists(tkaggbknd):
out += "\ntry: /usr/bin/otool -L "+tkaggbknd
else:
out += "\nPYRAFGRAPHICS not set"
if outstream:
outstream.write(out+'\n')
else:
print out
......@@ -549,4 +595,5 @@ else:
print "No graphics display available for this session."
print "Graphics tasks that attempt to plot to an interactive " + \
"screen will fail."
print 'For help, search "PyRAF FAQ 5.13" or contact "help@stsci.edu".'
print ""
......@@ -5,13 +5,14 @@ Changes
0.2.11 (unreleased)
-------------------
- Nothing changed yet.
- Replaced ``distribute_setup.py`` with ``ez_setup.py`` in order to bootstrap
with modern setuptools when necessary.
0.2.10 (2013-04-10)
-------------------
- Added support for the ``seutp-requires-dist`` option in the ``[metadata]``
- Added support for the ``setup-requires-dist`` option in the ``[metadata]``
section of setup.cfg. This is analogous to the Setup-Requires-Dist metadata
field supported by PEP-426 and uses the ``setup_requires`` argument to
setuptools' ``setup()`` to implement it.
......
......@@ -3,8 +3,7 @@ name = d2to1
version = 0.2.11.dev
author = Erik M. Bray
author-email = embray@stsci.edu
summary = Allows using distutils2-like setup.cfg files for a package's metadata
with a distribute/setuptools setup.py
summary = Allows using distutils2-like setup.cfg files for a package's metadata with a distribute/setuptools setup.py
description-file =
README.rst
CHANGES.rst
......@@ -30,7 +29,7 @@ packages =
extra_files =
CHANGES.rst
LICENSE
distribute_setup.py
ez_setup.py
[backwards_compat]
zip-safe = False
......
......@@ -2,7 +2,7 @@
try:
from setuptools import setup
except ImportError:
from distribute_setup import use_setuptools
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup
......
Changelog
===========
0.3.3 (unreleased)
0.3.5 (unreleased)
------------------
- Nothing changed yet.
0.3.4 (2013-07-31)
------------------
- Updated the check for ``__loader__`` added in v0.3.3 to only perform
that check on Python >= 3.3, since the issue doesn't apply to older
Python versions.
0.3.3 (2013-07-25)
------------------
- Updated the import-time SVN revision update mechanism in the ``version.py``
module generated by the ``version_setup_hook`` to avoid running when not in
a dev version of the package. This saves time on importing released