[Python-modules-commits] [fparser] 08/17: release 0.0.5

Alastair McKinstry mckinstry at moszumanska.debian.org
Tue Jul 25 15:16:42 UTC 2017


This is an automated email from the git hooks/post-receive script.

mckinstry pushed a commit to branch debian/master
in repository fparser.

commit 0b78bd855ed3536b615f365e75e31bc3414d9191
Author: Alastair McKinstry <mckinstry at debian.org>
Date:   Mon Jul 24 13:45:04 2017 +0100

    release 0.0.5
---
 CHANGELOG.md                              |  49 +++++++++++++++
 PKG-INFO                                  |  28 ---------
 doc/conf.py                               |   4 +-
 doc/fparser.rst                           |   6 +-
 setup.cfg                                 |   5 --
 setup.py                                  |   2 +-
 setup.py => src/__init__.py               |  63 -------------------
 src/fparser.egg-info/PKG-INFO             |  28 ---------
 src/fparser.egg-info/SOURCES.txt          |  53 ----------------
 src/fparser.egg-info/dependency_links.txt |   1 -
 src/fparser.egg-info/requires.txt         |   2 -
 src/fparser.egg-info/top_level.txt        |   1 -
 src/fparser/block_statements.py           |  11 +++-
 setup.py => src/fparser/scripts/f2003.py  |  98 +++++++++++------------------
 setup.py => src/fparser/scripts/parse.py  | 100 ++++++++++++------------------
 setup.py => src/fparser/scripts/read.py   |  94 ++++++++++------------------
 src/fparser/tests/funcfile.f95            |  71 +++++++++++++++++++++
 src/fparser/tests/modfile.f95             |  69 +++++++++++++++++++++
 src/fparser/tests/test_functional.py      |  60 ++++++++++++++++++
 19 files changed, 374 insertions(+), 371 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..5499de0
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,49 @@
+# Change log for the fparser package #
+
+Original code by Pearu Peterson.
+Modifications by Andrew Porter and Rupert Ford of the Science
+and Technology Facilities Council, UK.
+
+## Release 0.0.5 (20/06/2017) ##
+
+20/06/2017 issue #30 pr #31 Extend fparser1 to support
+ 	   Fortran2003 procedure declarations
+
+## Release 0.0.4 ##
+
+11/05/2017 pypi configuration was incorrect so 0.0.3 was
+           released on github but not on pypi. 0.0.4 has the
+           same functionality as 0.0.3 but is available on
+           both pypi and github.
+
+## Release 0.0.3 ##
+
+11/05/2017 #27 Fix a bug in fparser1 to support (Fortran2003)
+           class declarations e.g. CLASS(my_class) :: var
+
+## Release 0.0.2 ##
+
+22/03/2017 #11 Configure Travis to automatically release to
+           pypi when a tag is created. Create release 0.0.2.
+
+03/03/2017 #5 Extend fparser1 to support calls to type-bound
+           procedures when accessed via array elements.
+
+24/02/2017 #4 Extend fparser1 to support the (Fortran2003)
+           SELECT TYPE block.
+
+09/02/2017 #2 Create initial documentation, mostly based on
+	   Pearu's previous work.
+
+07/02/2017 #10 Merge in fixes to Fortran2003 parser originally
+  	   done as part of Habakkuk development.
+
+## Release 0.0.1 ##
+
+31/01/2017 #6 Create first release and upload to pypi.
+
+31/01/2017 #7 Apply regex bug-fix to 'entry' parsing so that
+	   all tests pass.
+
+16/01/2017 #1 Initial import of parser code extracted from
+	   the f2py project.
diff --git a/PKG-INFO b/PKG-INFO
deleted file mode 100644
index abcab98..0000000
--- a/PKG-INFO
+++ /dev/null
@@ -1,28 +0,0 @@
-Metadata-Version: 1.1
-Name: fparser
-Version: 0.0.4
-Summary: The fparser Project
-Home-page: https://github.com/stfc/fparser
-Author: Andrew Porter
-Author-email: trackstand.andy at gmail.com
-License: OSI Approved :: BSD 3-Clause License
-Description: The fparser project is created to develop a parser for
-        Fortran 77..2003 code. It is based on the work of Pearu Peterson in
-        the F2PY project (http://www.f2py.com). 
-        
-        See https://github.com/stfc/fparser for more information.
-        
-Platform: UNKNOWN
-Classifier: Development Status :: 3 - Alpha
-Classifier: Environment :: Console
-Classifier: Intended Audience :: Developers
-Classifier: Intended Audience :: Science/Research
-Classifier: Natural Language :: English
-Classifier: Programming Language :: Fortran
-Classifier: Programming Language :: Python
-Classifier: Topic :: Scientific/Engineering
-Classifier: Topic :: Software Development
-Classifier: Topic :: Utilities
-Classifier: Operating System :: POSIX
-Classifier: Operating System :: Unix
-Classifier: Operating System :: MacOS
diff --git a/doc/conf.py b/doc/conf.py
index 737692f..182c6d6 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -123,9 +123,9 @@ copyright = u'2017, Science and Technology Facilities Council'
 # built documents.
 #
 # The short X.Y version.
-version = '0.0.4'
+version = '0.0.5'
 # The full version, including alpha/beta/rc tags.
-release = '0.0.4'
+release = '0.0.5'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
diff --git a/doc/fparser.rst b/doc/fparser.rst
index 0650975..933b651 100644
--- a/doc/fparser.rst
+++ b/doc/fparser.rst
@@ -168,12 +168,16 @@ being added on an as-required basis and currently consists of:
 
   ::
 
-       call an_array(3)%a_proc(an_arg)
+     call an_array(3)%a_proc(an_arg)
 * Declaration of a CLASS variable (Fortran 2003), e.g.
   ::
 
      class(my_class) var
+* Declaration of a procedure (Fortran 2003), e.g.
+  ::
 
+     procedure(interface_name) :: proc
+     
 Reference
 ^^^^^^^^^
 
diff --git a/setup.cfg b/setup.cfg
deleted file mode 100644
index 861a9f5..0000000
--- a/setup.cfg
+++ /dev/null
@@ -1,5 +0,0 @@
-[egg_info]
-tag_build = 
-tag_date = 0
-tag_svn_revision = 0
-
diff --git a/setup.py b/setup.py
index 3607acd..539d732 100644
--- a/setup.py
+++ b/setup.py
@@ -102,7 +102,7 @@ CLASSIFIERS = [
 
 MAJOR = 0
 MINOR = 0
-MICRO = 4
+MICRO = 5
 VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO)
 
 if __name__ == '__main__':
diff --git a/setup.py b/src/__init__.py
similarity index 65%
copy from setup.py
copy to src/__init__.py
index 3607acd..1814d85 100644
--- a/setup.py
+++ b/src/__init__.py
@@ -1,5 +1,3 @@
-#!/usr/bin/env python
-
 # Modified work Copyright (c) 2017 Science and Technology Facilities Council
 # Original work Copyright (c) 1999-2008 Pearu Peterson
 
@@ -63,64 +61,3 @@
 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
 # DAMAGE.
-
-"""Setup script. Used by easy_install and pip."""
-
-from setuptools import setup, find_packages
-
-PACKAGES = find_packages(where="src")
-
-NAME = 'fparser'
-AUTHOR = 'Andrew Porter'
-AUTHOR_EMAIL = 'trackstand.andy at gmail.com'
-URL = 'https://github.com/stfc/fparser'
-DOWNLOAD_URL = 'https://github.com/stfc/fparser'
-DESCRIPTION = 'The fparser Project'
-LONG_DESCRIPTION = '''\
-The fparser project is created to develop a parser for
-Fortran 77..2003 code. It is based on the work of Pearu Peterson in
-the F2PY project (http://www.f2py.com). 
-
-See https://github.com/stfc/fparser for more information.
-'''
-LICENSE='OSI Approved :: BSD 3-Clause License'
-
-CLASSIFIERS = [
-    'Development Status :: 3 - Alpha',
-    'Environment :: Console',
-    'Intended Audience :: Developers',
-    'Intended Audience :: Science/Research',
-    'Natural Language :: English',
-    'Programming Language :: Fortran',
-    'Programming Language :: Python',
-    'Topic :: Scientific/Engineering',
-    'Topic :: Software Development',
-    'Topic :: Utilities',
-    'Operating System :: POSIX',
-    'Operating System :: Unix',
-    'Operating System :: MacOS']
-
-MAJOR = 0
-MINOR = 0
-MICRO = 4
-VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO)
-
-if __name__ == '__main__':
-
-    setup(
-        name=NAME,
-        version=VERSION,
-        author=AUTHOR,
-        author_email=(AUTHOR_EMAIL),
-        license=LICENSE,
-        url=URL,
-        description=DESCRIPTION,
-        long_description=LONG_DESCRIPTION,
-        classifiers=CLASSIFIERS,
-        packages=PACKAGES,
-        package_dir={"": "src"},
-        install_requires=['numpy', 'nose'],
-        # We need the following line to ensure we get the fparser/log.config
-        # file installed.
-        include_package_data=True)
-
diff --git a/src/fparser.egg-info/PKG-INFO b/src/fparser.egg-info/PKG-INFO
deleted file mode 100644
index abcab98..0000000
--- a/src/fparser.egg-info/PKG-INFO
+++ /dev/null
@@ -1,28 +0,0 @@
-Metadata-Version: 1.1
-Name: fparser
-Version: 0.0.4
-Summary: The fparser Project
-Home-page: https://github.com/stfc/fparser
-Author: Andrew Porter
-Author-email: trackstand.andy at gmail.com
-License: OSI Approved :: BSD 3-Clause License
-Description: The fparser project is created to develop a parser for
-        Fortran 77..2003 code. It is based on the work of Pearu Peterson in
-        the F2PY project (http://www.f2py.com). 
-        
-        See https://github.com/stfc/fparser for more information.
-        
-Platform: UNKNOWN
-Classifier: Development Status :: 3 - Alpha
-Classifier: Environment :: Console
-Classifier: Intended Audience :: Developers
-Classifier: Intended Audience :: Science/Research
-Classifier: Natural Language :: English
-Classifier: Programming Language :: Fortran
-Classifier: Programming Language :: Python
-Classifier: Topic :: Scientific/Engineering
-Classifier: Topic :: Software Development
-Classifier: Topic :: Utilities
-Classifier: Operating System :: POSIX
-Classifier: Operating System :: Unix
-Classifier: Operating System :: MacOS
diff --git a/src/fparser.egg-info/SOURCES.txt b/src/fparser.egg-info/SOURCES.txt
deleted file mode 100644
index cf6f7df..0000000
--- a/src/fparser.egg-info/SOURCES.txt
+++ /dev/null
@@ -1,53 +0,0 @@
-LICENSE
-MANIFEST.in
-README.md
-__init__.py
-setup.py
-doc/Makefile
-doc/conf.py
-doc/fparser.rst
-doc/fparser2.rst
-doc/index.rst
-doc/introduction.rst
-doc/license.rst
-src/fparser/Fortran2003.py
-src/fparser/__init__.py
-src/fparser/api.py
-src/fparser/base_classes.py
-src/fparser/block_statements.py
-src/fparser/log.config
-src/fparser/parsefortran.py
-src/fparser/pattern_tools.py
-src/fparser/readfortran.py
-src/fparser/script_options.py
-src/fparser/setup.py
-src/fparser/sourceinfo.py
-src/fparser/splitline.py
-src/fparser/statements.py
-src/fparser/typedecl_statements.py
-src/fparser/utils.py
-src/fparser.egg-info/PKG-INFO
-src/fparser.egg-info/SOURCES.txt
-src/fparser.egg-info/dependency_links.txt
-src/fparser.egg-info/requires.txt
-src/fparser.egg-info/top_level.txt
-src/fparser/tests/test_Fortran2003.py
-src/fparser/tests/test_api.py
-src/fparser/tests/test_blank_lines.py
-src/fparser/tests/test_comment.py
-src/fparser/tests/test_f90comment_f77source.py
-src/fparser/tests/test_issue10.py
-src/fparser/tests/test_issue11.py
-src/fparser/tests/test_issue23.py
-src/fparser/tests/test_issue25.py
-src/fparser/tests/test_issue26.py
-src/fparser/tests/test_issue33.py
-src/fparser/tests/test_issue4.py
-src/fparser/tests/test_issue5.py
-src/fparser/tests/test_issue7.py
-src/fparser/tests/test_issue8.py
-src/fparser/tests/test_issue9.py
-src/fparser/tests/test_mod_private.py
-src/fparser/tests/test_parser.py
-src/fparser/tests/test_select.py
-src/fparser/tests/test_utils.py
\ No newline at end of file
diff --git a/src/fparser.egg-info/dependency_links.txt b/src/fparser.egg-info/dependency_links.txt
deleted file mode 100644
index 8b13789..0000000
--- a/src/fparser.egg-info/dependency_links.txt
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/src/fparser.egg-info/requires.txt b/src/fparser.egg-info/requires.txt
deleted file mode 100644
index 02e0c84..0000000
--- a/src/fparser.egg-info/requires.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-numpy
-nose
diff --git a/src/fparser.egg-info/top_level.txt b/src/fparser.egg-info/top_level.txt
deleted file mode 100644
index 2a23aec..0000000
--- a/src/fparser.egg-info/top_level.txt
+++ /dev/null
@@ -1 +0,0 @@
-fparser
diff --git a/src/fparser/block_statements.py b/src/fparser/block_statements.py
index 58122a2..22502a4 100644
--- a/src/fparser/block_statements.py
+++ b/src/fparser/block_statements.py
@@ -688,7 +688,10 @@ class SubProgramStatement(BeginStatement, ProgramBlock,
             elif isinstance(stmt, self.end_stmt_cls):
                 continue
             else:
-                stmt.analyze()
+                if hasattr(stmt, "analyze"):
+                    stmt.analyze()
+                else:
+                    raise AnalyzeError('Failed to parse: {0}'.format(str(stmt)))
 
         if content:
             logger.info('Not analyzed content: %s' % content)
@@ -1361,9 +1364,11 @@ internal_subprogram = [Function, Subroutine]
 
 internal_subprogram_part = [Contains, ] + internal_subprogram
 
+# In Fortran2003 we can have a Procedure declaration. We therefore
+# include SpecificBinding as a valid declaration construct.
 declaration_construct = [TypeDecl, Entry, Enum, Format, Interface,
-    Parameter, ModuleProcedure,] + specification_stmt + \
-    type_declaration_stmt
+                         Parameter, ModuleProcedure, SpecificBinding] + \
+    specification_stmt + type_declaration_stmt
 # stmt-function-stmt
 
 implicit_part = [ Implicit, Parameter, Format, Entry ]
diff --git a/setup.py b/src/fparser/scripts/f2003.py
similarity index 66%
copy from setup.py
copy to src/fparser/scripts/f2003.py
index 3607acd..406c9b5 100644
--- a/setup.py
+++ b/src/fparser/scripts/f2003.py
@@ -1,5 +1,4 @@
 #!/usr/bin/env python
-
 # Modified work Copyright (c) 2017 Science and Technology Facilities Council
 # Original work Copyright (c) 1999-2008 Pearu Peterson
 
@@ -64,63 +63,40 @@
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
 # DAMAGE.
 
-"""Setup script. Used by easy_install and pip."""
-
-from setuptools import setup, find_packages
-
-PACKAGES = find_packages(where="src")
-
-NAME = 'fparser'
-AUTHOR = 'Andrew Porter'
-AUTHOR_EMAIL = 'trackstand.andy at gmail.com'
-URL = 'https://github.com/stfc/fparser'
-DOWNLOAD_URL = 'https://github.com/stfc/fparser'
-DESCRIPTION = 'The fparser Project'
-LONG_DESCRIPTION = '''\
-The fparser project is created to develop a parser for
-Fortran 77..2003 code. It is based on the work of Pearu Peterson in
-the F2PY project (http://www.f2py.com). 
-
-See https://github.com/stfc/fparser for more information.
-'''
-LICENSE='OSI Approved :: BSD 3-Clause License'
-
-CLASSIFIERS = [
-    'Development Status :: 3 - Alpha',
-    'Environment :: Console',
-    'Intended Audience :: Developers',
-    'Intended Audience :: Science/Research',
-    'Natural Language :: English',
-    'Programming Language :: Fortran',
-    'Programming Language :: Python',
-    'Topic :: Scientific/Engineering',
-    'Topic :: Software Development',
-    'Topic :: Utilities',
-    'Operating System :: POSIX',
-    'Operating System :: Unix',
-    'Operating System :: MacOS']
-
-MAJOR = 0
-MINOR = 0
-MICRO = 4
-VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO)
-
-if __name__ == '__main__':
-
-    setup(
-        name=NAME,
-        version=VERSION,
-        author=AUTHOR,
-        author_email=(AUTHOR_EMAIL),
-        license=LICENSE,
-        url=URL,
-        description=DESCRIPTION,
-        long_description=LONG_DESCRIPTION,
-        classifiers=CLASSIFIERS,
-        packages=PACKAGES,
-        package_dir={"": "src"},
-        install_requires=['numpy', 'nose'],
-        # We need the following line to ensure we get the fparser/log.config
-        # file installed.
-        include_package_data=True)
-
+import os
+import sys
+### START UPDATE SYS.PATH ###
+### END UPDATE SYS.PATH ###
+try:
+    from iocbio.optparse_gui import OptionParser
+except ImportError:
+    from optparse import OptionParser
+from fparser.script_options import set_f2003_options
+
+def runner (parser, options, args):
+    from fparser.api import Fortran2003
+    from fparser.readfortran import  FortranFileReader
+    for filename in args:
+        reader = FortranFileReader(filename)
+        if options.mode != 'auto':
+            reader.set_mode_from_str(options.mode)
+        try:
+            program = Fortran2003.Program(reader)
+            print program
+        except Fortran2003.NoMatchError, msg:
+            print 'parsing %r failed at %s' % (filename, reader.fifo_item[-1])
+            print 'started at %s' % (reader.fifo_item[0])
+            print 'quiting'
+            return
+
+def main ():
+    parser = OptionParser()
+    set_f2003_options(parser)
+    if hasattr(parser, 'runner'):
+        parser.runner = runner
+    options, args = parser.parse_args()
+    runner(parser, options, args)
+    return
+
+if __name__=="__main__":
+    main()
diff --git a/setup.py b/src/fparser/scripts/parse.py
similarity index 66%
copy from setup.py
copy to src/fparser/scripts/parse.py
index 3607acd..2fb20db 100644
--- a/setup.py
+++ b/src/fparser/scripts/parse.py
@@ -1,5 +1,4 @@
 #!/usr/bin/env python
-
 # Modified work Copyright (c) 2017 Science and Technology Facilities Council
 # Original work Copyright (c) 1999-2008 Pearu Peterson
 
@@ -64,63 +63,42 @@
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
 # DAMAGE.
 
-"""Setup script. Used by easy_install and pip."""
-
-from setuptools import setup, find_packages
-
-PACKAGES = find_packages(where="src")
-
-NAME = 'fparser'
-AUTHOR = 'Andrew Porter'
-AUTHOR_EMAIL = 'trackstand.andy at gmail.com'
-URL = 'https://github.com/stfc/fparser'
-DOWNLOAD_URL = 'https://github.com/stfc/fparser'
-DESCRIPTION = 'The fparser Project'
-LONG_DESCRIPTION = '''\
-The fparser project is created to develop a parser for
-Fortran 77..2003 code. It is based on the work of Pearu Peterson in
-the F2PY project (http://www.f2py.com). 
-
-See https://github.com/stfc/fparser for more information.
-'''
-LICENSE='OSI Approved :: BSD 3-Clause License'
-
-CLASSIFIERS = [
-    'Development Status :: 3 - Alpha',
-    'Environment :: Console',
-    'Intended Audience :: Developers',
-    'Intended Audience :: Science/Research',
-    'Natural Language :: English',
-    'Programming Language :: Fortran',
-    'Programming Language :: Python',
-    'Topic :: Scientific/Engineering',
-    'Topic :: Software Development',
-    'Topic :: Utilities',
-    'Operating System :: POSIX',
-    'Operating System :: Unix',
-    'Operating System :: MacOS']
-
-MAJOR = 0
-MINOR = 0
-MICRO = 4
-VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO)
-
-if __name__ == '__main__':
-
-    setup(
-        name=NAME,
-        version=VERSION,
-        author=AUTHOR,
-        author_email=(AUTHOR_EMAIL),
-        license=LICENSE,
-        url=URL,
-        description=DESCRIPTION,
-        long_description=LONG_DESCRIPTION,
-        classifiers=CLASSIFIERS,
-        packages=PACKAGES,
-        package_dir={"": "src"},
-        install_requires=['numpy', 'nose'],
-        # We need the following line to ensure we get the fparser/log.config
-        # file installed.
-        include_package_data=True)
-
+import os
+import sys
+### START UPDATE SYS.PATH ###
+### END UPDATE SYS.PATH ###
+try:
+    from iocbio.optparse_gui import OptionParser
+except ImportError:
+    from optparse import OptionParser
+from fparser.script_options import set_parse_options
+
+def runner (parser, options, args):
+    from fparser.readfortran import  FortranFileReader
+    from fparser.parsefortran import  FortranParser
+    for filename in args:
+        reader = FortranFileReader(filename)
+        if options.mode != 'auto':
+            reader.set_mode_from_str(options.mode)
+        parser = FortranParser(reader)
+        parser.parse()
+        parser.analyze()
+        if options.task=='show':
+            print parser.block.torepr(4)
+        elif options.task == 'none':
+            pass
+        else:
+            raise NotImplementedError(`options.task`)
+        
+
+def main ():
+    parser = OptionParser()
+    set_parse_options(parser)
+    if hasattr(parser, 'runner'):
+        parser.runner = runner
+    options, args = parser.parse_args()
+    runner(parser, options, args)
+    return
+
+if __name__=="__main__":
+    main()
diff --git a/setup.py b/src/fparser/scripts/read.py
similarity index 66%
copy from setup.py
copy to src/fparser/scripts/read.py
index 3607acd..33781e1 100644
--- a/setup.py
+++ b/src/fparser/scripts/read.py
@@ -1,5 +1,4 @@
 #!/usr/bin/env python
-
 # Modified work Copyright (c) 2017 Science and Technology Facilities Council
 # Original work Copyright (c) 1999-2008 Pearu Peterson
 
@@ -64,63 +63,36 @@
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
 # DAMAGE.
 
-"""Setup script. Used by easy_install and pip."""
-
-from setuptools import setup, find_packages
-
-PACKAGES = find_packages(where="src")
-
-NAME = 'fparser'
-AUTHOR = 'Andrew Porter'
-AUTHOR_EMAIL = 'trackstand.andy at gmail.com'
-URL = 'https://github.com/stfc/fparser'
-DOWNLOAD_URL = 'https://github.com/stfc/fparser'
-DESCRIPTION = 'The fparser Project'
-LONG_DESCRIPTION = '''\
-The fparser project is created to develop a parser for
-Fortran 77..2003 code. It is based on the work of Pearu Peterson in
-the F2PY project (http://www.f2py.com). 
-
-See https://github.com/stfc/fparser for more information.
-'''
-LICENSE='OSI Approved :: BSD 3-Clause License'
-
-CLASSIFIERS = [
-    'Development Status :: 3 - Alpha',
-    'Environment :: Console',
-    'Intended Audience :: Developers',
-    'Intended Audience :: Science/Research',
-    'Natural Language :: English',
-    'Programming Language :: Fortran',
-    'Programming Language :: Python',
-    'Topic :: Scientific/Engineering',
-    'Topic :: Software Development',
-    'Topic :: Utilities',
-    'Operating System :: POSIX',
-    'Operating System :: Unix',
-    'Operating System :: MacOS']
-
-MAJOR = 0
-MINOR = 0
-MICRO = 4
-VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO)
-
-if __name__ == '__main__':
-
-    setup(
-        name=NAME,
-        version=VERSION,
-        author=AUTHOR,
-        author_email=(AUTHOR_EMAIL),
-        license=LICENSE,
-        url=URL,
-        description=DESCRIPTION,
-        long_description=LONG_DESCRIPTION,
-        classifiers=CLASSIFIERS,
-        packages=PACKAGES,
-        package_dir={"": "src"},
-        install_requires=['numpy', 'nose'],
-        # We need the following line to ensure we get the fparser/log.config
-        # file installed.
-        include_package_data=True)
-
+import os
+import sys
+### START UPDATE SYS.PATH ###
+### END UPDATE SYS.PATH ###
+try:
+    from iocbio.optparse_gui import OptionParser
+except ImportError:
+    from optparse import OptionParser
+from fparser.script_options import set_read_options
+
+def runner (parser, options, args):
+    from fparser.readfortran import  FortranFileReader
+    for filename in args:
+        reader = FortranFileReader(filename)
+        if options.task=='show':
+            for item in reader:
+                print >> sys.stdout, item
+                sys.stdout.flush()
+        else:
+            raise NotImplementedError(`options.task`)
+        
+
+def main ():
+    parser = OptionParser()
+    set_read_options(parser)
+    if hasattr(parser, 'runner'):
+        parser.runner = runner
+    options, args = parser.parse_args()
+    runner(parser, options, args)
+    return
+
+if __name__=="__main__":
+    main()
diff --git a/src/fparser/tests/funcfile.f95 b/src/fparser/tests/funcfile.f95
new file mode 100644
index 0000000..dd55d5c
--- /dev/null
+++ b/src/fparser/tests/funcfile.f95
@@ -0,0 +1,71 @@
+! Modified work Copyright (c) 2017 Science and Technology Facilities Council
+! Original work Copyright (c) 1999-2008 Pearu Peterson
+
+! All rights reserved.
+
+! Modifications made as part of the fparser project are distributed
+! under the following license:
+
+! Redistribution and use in source and binary forms, with or without
+! modification, are permitted provided that the following conditions are
+! met:
+
+! 1. Redistributions of source code must retain the above copyright
+! notice, this list of conditions and the following disclaimer.
+
+! 2. Redistributions in binary form must reproduce the above copyright
+! notice, this list of conditions and the following disclaimer in the
+! documentation and/or other materials provided with the distribution.
+
+! 3. Neither the name of the copyright holder nor the names of its
+! contributors may be used to endorse or promote products derived from
+! this software without specific prior written permission.
+
+! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+! "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+! LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+! A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+! HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+! LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+! DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+! THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+! (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+! OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+! --------------------------------------------------------------------
+
+! The original software (in the f2py project) was distributed under
+! the following license:
+
+! Redistribution and use in source and binary forms, with or without
+! modification, are permitted provided that the following conditions are met:
+
+!   a. Redistributions of source code must retain the above copyright notice,
+!      this list of conditions and the following disclaimer.
+!   b. Redistributions in binary form must reproduce the above copyright
+!      notice, this list of conditions and the following disclaimer in the
+!      documentation and/or other materials provided with the distribution.
+!   c. Neither the name of the F2PY project nor the names of its
+!      contributors may be used to endorse or promote products derived from
+!      this software without specific prior written permission.
+
+! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+! AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+! ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
+! ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+! DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+! SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+! CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+! LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+! OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+! DAMAGE.
+
+      program foo
+      use testmod
+      implicit none
+
+      print *, i
+
+      end program foo
diff --git a/src/fparser/tests/modfile.f95 b/src/fparser/tests/modfile.f95
new file mode 100644
index 0000000..85f9299
--- /dev/null
+++ b/src/fparser/tests/modfile.f95
@@ -0,0 +1,69 @@
+! Modified work Copyright (c) 2017 Science and Technology Facilities Council
+! Original work Copyright (c) 1999-2008 Pearu Peterson
+
+! All rights reserved.
+
+! Modifications made as part of the fparser project are distributed
+! under the following license:
+
+! Redistribution and use in source and binary forms, with or without
+! modification, are permitted provided that the following conditions are
+! met:
+
+! 1. Redistributions of source code must retain the above copyright
+! notice, this list of conditions and the following disclaimer.
+
+! 2. Redistributions in binary form must reproduce the above copyright
+! notice, this list of conditions and the following disclaimer in the
+! documentation and/or other materials provided with the distribution.
+
+! 3. Neither the name of the copyright holder nor the names of its
+! contributors may be used to endorse or promote products derived from
+! this software without specific prior written permission.
+
+! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+! "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+! LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+! A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+! HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+! LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+! DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+! THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+! (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+! OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+! --------------------------------------------------------------------
+
+! The original software (in the f2py project) was distributed under
+! the following license:
+
+! Redistribution and use in source and binary forms, with or without
+! modification, are permitted provided that the following conditions are met:
+
+!   a. Redistributions of source code must retain the above copyright notice,
+!      this list of conditions and the following disclaimer.
+!   b. Redistributions in binary form must reproduce the above copyright
+!      notice, this list of conditions and the following disclaimer in the
+!      documentation and/or other materials provided with the distribution.
+!   c. Neither the name of the F2PY project nor the names of its
+!      contributors may be used to endorse or promote products derived from
+!      this software without specific prior written permission.
+
+! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+! AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+! ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
+! ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+! DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+! SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+! CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+! LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+! OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+! DAMAGE.
+
+      module testmod
+      implicit none
+      integer, parameter :: i = 20
+
+      end module testmod
diff --git a/src/fparser/tests/test_functional.py b/src/fparser/tests/test_functional.py
new file mode 100644
index 0000000..16f9744
--- /dev/null
+++ b/src/fparser/tests/test_functional.py
@@ -0,0 +1,60 @@
+# Copyright (c) 2017 Science and Technology Facilities Council
+
+# All rights reserved.
+
+# Modifications made as part of the fparser project are distributed
+# under the following license:
+
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+
+# 3. Neither the name of the copyright holder nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+''' Module containing functional tests - i.e. tests of specific functionality
+    within the context of parsing a piece of compilable Fortran '''
+
+
+def test_procedure_interface():
+    ''' Test that parser copes with a procedure declaration in
+    a subroutine '''
+    from fparser import api
+    source_str = '''  subroutine proc_interface_test()
+    use field_mod,                   only: field_type, write_interface
+    use fs_continuity_mod,           only: W3
+    use io_mod,                      only: write_field
+    implicit none
+    type(field_type)                      :: divergence
+    procedure (write_interface), pointer  :: tmp_ptr
+
+    divergence = field_type( vector_space = &
+                    function_space_collection%get_fs(0, 0, W3) )
+    tmp_ptr => write_field
+    call divergence%set_write_field_behaviour(write_field)
+  end subroutine proc_interface_test
+'''
+    tree = api.parse(source_str, isfree=True, isstrict=False,
+                     ignore_comments=False)
+    gen_code = str(tree)
+    assert "PROCEDURE (write_interface) , POINTER :: tmp_ptr" in gen_code

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/fparser.git



More information about the Python-modules-commits mailing list