[instant] 01/03: New upstream version 2017.1.0

Johannes Ring johannr-guest at moszumanska.debian.org
Wed May 10 10:01:08 UTC 2017


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

johannr-guest pushed a commit to branch experimental
in repository instant.

commit 2e6242e2cb2b8ca7e0dea9e17900e65ec9453095
Author: Johannes Ring <johannr at simula.no>
Date:   Wed May 10 11:53:30 2017 +0200

    New upstream version 2017.1.0
---
 ChangeLog                                |  81 --------------
 ChangeLog.rst                            | 180 +++++++++++++++++++++++++++++++
 MANIFEST.in                              |   9 ++
 README.rst                               |   2 +-
 doc/sphinx/source/conf.py                |  18 ++--
 doc/sphinx/source/releases.rst           |   2 +
 doc/sphinx/source/releases/v2016.2.0.rst |  10 ++
 doc/sphinx/source/releases/v2017.1.0.rst |   7 ++
 instant/__init__.py                      |   4 +-
 instant/build.py                         |  33 +++---
 instant/codegeneration.py                |  23 ++--
 instant/output.py                        |  12 ++-
 instant/signatures.py                    |   3 +-
 setup.py                                 |   5 +-
 14 files changed, 258 insertions(+), 131 deletions(-)

diff --git a/ChangeLog b/ChangeLog
deleted file mode 100644
index 0f6c46b..0000000
--- a/ChangeLog
+++ /dev/null
@@ -1,81 +0,0 @@
-2016.2.0 [2016-11-30]
- - Add Python version string to hash signature input
- - Add pipelines testing, with py2 and py3 coverage
- - Remove commands module (removed from Py3)
- - Switch unit tests to pytest
-2016.1.0 [2016-06-23]
- - Minor fixes
-1.6.0 [2015-07-28]
- - Minor fixes
-1.5.0 [2015-01-12]
- - Require Python 2.7
- - Python 3 support
-1.4.0 [2014-06-02]
- - Introduce env var INSTANT_SYSTEM_CALL_METHOD for switching method for calling
-   external programs and introduce possibly OFED-fork safe implementation
-1.3.0 [2014-01-07]
- - Add file_lock which can be used within a with statement
- - Introduce set_log_level and deprecate set_logging_level
-1.2.0 [2013-03-24]
- - Allow to use CMake instead of distutils/pkg-config
-1.1.0 [2013-01-07]
- - Converting python2 syntax to python3 (run 2to3)
- - Patch to make instant work with python2
- - Cache dir is now created if not existing
-1.0.0 [2011-12-07]
- - Copy all files to ~/.instant/error/module_name when Instant fails
- - If environmental variable INSTANT_DISPLAY_COMPILE_LOG is set the content
-   of compile.log will be displayed
- - Removed copying of compile.log to ~/.instant/error/
-1.0-beta2 [2011-10-28]
- - Added support for flufl.lock for NFS safe file locking
-1.0-beta [2011-08-11]
- - Error log is now copied to ~/.instant/error/module_name/compile.log
-   and ~/.instant/error/compile.log for easier retrieval
-0.9.10 [2011-05-16]
- - Added support for setting swig binary and swig path
-0.9.9 [2011-02-23]
- - Optimizations
- - Added support for VTK and VMTK
-0.9.8 [2010-02-15]
- - Fix cache related memory leak
-0.9.7
- - Use typemaps from the NumPy SWIG interface file (numpy.i)
-   enabling the use of many new data types.
- - Removed support for Numeric and numarray.
-0.9.6
- - Minor update with some new utility functions required by FFC.
-0.9.5
- - Restructured and rewritten much of the code.
- - Improved multilevel cache functionality.
- - Added instant-clean and instant-showcache scripts.
-0.9.4
- - Various new examples with swiginac and sympy implemented.
- - Bug fix on 64bit. Removed director flag by default.
-0.9.3
- - Implemented caching
-0.9.2
- - Bug fix for the JIT in FFC
-0.9.1
- - Added test example which demonstrate use of external C code.
- - Added flag to turn of regeneration of the interface file
-   (useful during debugging)
-0.9
- - Port to Windows with mingw by laserjungle, some updates
-   by Martin Alnæs, and some cleanup.
-0.8
- - Added support for NumPy and Numarray.
-0.7
- - Added functionality for the use of pkg-config files.
-0.6
- - Created a more user-friendly interface
-0.5
- - Added SWIG directors for cross language inheritance
-0.4
- - Added md5sum to avoid unnecessary compilation
-0.3
- - Support for NumPy arrays
-0.2
- - Fixed bug in setup script
-0.1
- - Initial release of Instant
diff --git a/ChangeLog.rst b/ChangeLog.rst
new file mode 100644
index 0000000..5b94833
--- /dev/null
+++ b/ChangeLog.rst
@@ -0,0 +1,180 @@
+Changelog
+=========
+
+2017.1.0 (2017-05-09)
+---------------------
+
+- Minor fixes
+
+2016.2.0 (2016-11-30)
+---------------------
+
+- Add Python version string to hash signature input
+- Add pipelines testing, with py2 and py3 coverage
+- Remove commands module (removed from Py3)
+- Switch unit tests to pytest
+
+2016.1.0 (2016-06-23)
+---------------------
+
+- Minor fixes
+
+1.6.0 (2015-07-28)
+------------------
+
+- Minor fixes
+
+1.5.0 (2015-01-12)
+------------------
+
+- Require Python 2.7
+- Python 3 support
+
+1.4.0 (2014-06-02)
+------------------
+
+- Introduce env var ``INSTANT_SYSTEM_CALL_METHOD`` for switching method
+  for calling external programs and introduce possibly OFED-fork safe
+  implementation
+
+1.3.0 (2014-01-07)
+------------------
+
+- Add ``file_lock`` which can be used within a ``with`` statement
+- Introduce ``set_log_level`` and deprecate ``set_logging_level``
+
+1.2.0 (2013-03-24)
+------------------
+
+- Allow to use CMake instead of distutils/pkg-config
+
+1.1.0 (2013-01-07)
+------------------
+
+- Converting python2 syntax to python3 (run 2to3)
+- Patch to make instant work with python2
+- Cache dir is now created if not existing
+
+1.0.0 (2011-12-07)
+------------------
+
+- Copy all files to ``~/.instant/error/module_name`` when Instant fails
+- If environment variable ``INSTANT_DISPLAY_COMPILE_LOG`` is set the
+  content of ``compile.log`` will be displayed
+- Removed copying of ``compile.log`` to ``~/.instant/error/``
+
+1.0-beta2 (2011-10-28)
+----------------------
+
+- Added support for flufl.lock for NFS safe file locking
+
+1.0-beta (2011-08-11)
+---------------------
+
+- Error log is now copied to
+  ``~/.instant/error/module_name/compile.log`` and
+  ``~/.instant/error/compile.log`` for easier retrieval
+
+0.9.10 (2011-05-16)
+-------------------
+
+- Added support for setting swig binary and swig path
+
+0.9.9 (2011-02-23)
+------------------
+
+- Optimizations
+- Added support for VTK and VMTK
+
+0.9.8 (2010-02-15)
+------------------
+
+- Fix cache related memory leak
+
+0.9.7
+-----
+
+- Use typemaps from the NumPy SWIG interface file (numpy.i)
+  enabling the use of many new data types.
+- Removed support for Numeric and numarray.
+
+0.9.6
+-----
+
+- Minor update with some new utility functions required by FFC.
+
+0.9.5
+-----
+
+- Restructured and rewritten much of the code.
+- Improved multilevel cache functionality.
+- Added instant-clean and instant-showcache scripts.
+
+0.9.4
+-----
+
+- Various new examples with swiginac and sympy implemented.
+- Bug fix on 64bit. Removed director flag by default.
+
+0.9.3
+-----
+
+- Implemented caching
+
+0.9.2
+-----
+
+- Bug fix for the JIT in FFC
+
+0.9.1
+-----
+
+- Added test example which demonstrate use of external C code.
+- Added flag to turn of regeneration of the interface file (useful
+  during debugging)
+
+0.9
+---
+
+- Port to Windows with mingw by laserjungle, some updates by Martin
+  Alnæs, and some cleanup.
+
+0.8
+---
+
+- Added support for NumPy and Numarray.
+
+0.7
+---
+
+- Added functionality for the use of pkg-config files.
+
+0.6
+---
+
+- Created a more user-friendly interface
+
+0.5
+---
+
+- Added SWIG directors for cross language inheritance
+
+0.4
+---
+
+- Added md5sum to avoid unnecessary compilation
+
+0.3
+---
+
+- Support for NumPy arrays
+
+0.2
+---
+
+- Fixed bug in setup script
+
+0.1
+---
+
+- Initial release of Instant
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..62f1f93
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1,9 @@
+include AUTHORS
+include COPYING
+include COPYING.LESSER
+include ChangeLog
+include LICENSE
+include TODO
+recursive-include doc *
+recursive-include test *
+global-exclude __pycache__ *.pyc
diff --git a/README.rst b/README.rst
index 8db5741..2dcc269 100644
--- a/README.rst
+++ b/README.rst
@@ -40,7 +40,7 @@ Code Coverage
 =============
 
 Code coverage reports can be viewed at
-https://coveralls.io/repos/bitbucket/fenics-project/instant.
+https://coveralls.io/bitbucket/fenics-project/instant.
 
 .. image:: https://coveralls.io/repos/bitbucket/fenics-project/instant/badge.svg?branch=master
    :target: https://coveralls.io/bitbucket/fenics-project/instant?branch=master
diff --git a/doc/sphinx/source/conf.py b/doc/sphinx/source/conf.py
index c5bb1d4..555297f 100644
--- a/doc/sphinx/source/conf.py
+++ b/doc/sphinx/source/conf.py
@@ -14,6 +14,8 @@
 
 import sys
 import os
+import pkg_resources
+import datetime
 
 # If extensions (or modules to document with autodoc) are in another directory,
 # add these directories to sys.path here. If the directory is relative to the
@@ -51,18 +53,10 @@ master_doc = 'index'
 
 # General information about the project.
 project = u'Instant'
-copyright = u'2015, FEniCS Project'
-
-# The version info for the project you're documenting, acts as replacement for
-# |version| and |release|, also used in various other places throughout the
-# built documents.
-#
-import instant
-instant_version = instant.__version__
-# The short X.Y version.
-version = instant_version
-# The full version, including alpha/beta/rc tags.
-release = instant_version
+this_year = datetime.date.today().year
+copyright = u'%s, FEniCS Project' % this_year
+version = pkg_resources.get_distribution("instant").version
+release = version
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
diff --git a/doc/sphinx/source/releases.rst b/doc/sphinx/source/releases.rst
index 796ed29..ee8b507 100644
--- a/doc/sphinx/source/releases.rst
+++ b/doc/sphinx/source/releases.rst
@@ -9,5 +9,7 @@ Release notes
    :maxdepth: 2
 
    releases/next
+   releases/v2017.1.0
+   releases/v2016.2.0
    releases/v2016.1.0
    releases/v1.6.0
diff --git a/doc/sphinx/source/releases/v2016.2.0.rst b/doc/sphinx/source/releases/v2016.2.0.rst
new file mode 100644
index 0000000..ab4f102
--- /dev/null
+++ b/doc/sphinx/source/releases/v2016.2.0.rst
@@ -0,0 +1,10 @@
+===========================
+Changes in version 2016.2.0
+===========================
+
+Instant 2016.2.0 was released on 2016-11-30.
+
+- Add Python version string to hash signature input
+- Add pipelines testing, with py2 and py3 coverage
+- Remove commands module (removed from Py3)
+- Switch unit tests to pytest
diff --git a/doc/sphinx/source/releases/v2017.1.0.rst b/doc/sphinx/source/releases/v2017.1.0.rst
new file mode 100644
index 0000000..2bd36de
--- /dev/null
+++ b/doc/sphinx/source/releases/v2017.1.0.rst
@@ -0,0 +1,7 @@
+===========================
+Changes in version 2017.1.0
+===========================
+
+Instant 2017.1.0 was released on 2017-05-09.
+
+- Minor fixes
diff --git a/instant/__init__.py b/instant/__init__.py
index 1a5ca2f..ab0e5f6 100644
--- a/instant/__init__.py
+++ b/instant/__init__.py
@@ -16,9 +16,11 @@ For more examples, see the tests/ directory in the Instant distribution.
 Questions, bugs and patches should be sent to fenics-dev at googlegroups.com.
 """
 
+import pkg_resources
+
 __authors__ = "Magne Westlie, Kent-Andre Mardal <kent-and at simula.no>, Martin Alnes <martinal at simula.no>, Ilmar M. Wilbers <ilmarw at simula.no>"
 __date__ = "2016-11-30"
-__version__ = "2016.2.0"
+__version__ = pkg_resources.get_distribution("instant").version
 
 # TODO: Import only the official interface
 from .output import *
diff --git a/instant/build.py b/instant/build.py
index 3bfdc9d..054d989 100644
--- a/instant/build.py
+++ b/instant/build.py
@@ -22,7 +22,10 @@
 #
 # Alternatively, Instant may be distributed under the terms of the BSD license.
 
-import os, sys, shutil, glob, errno
+import six
+from six import string_types
+
+import io, os, sys, shutil, glob, errno
 from itertools import chain
 
 # TODO: Import only the official interface
@@ -35,7 +38,7 @@ from .locking import file_lock
 
 
 def assert_is_str(x):
-    instant_assert(isinstance(x, str), "In instant.build_module: Expecting string.")
+    instant_assert(isinstance(x, string_types), "In instant.build_module: Expecting string.")
 
 
 def assert_is_bool(x):
@@ -44,7 +47,7 @@ def assert_is_bool(x):
 
 def assert_is_str_list(x):
     instant_assert(isinstance(x, (list, tuple)), "In instant.build_module: Expecting sequence.")
-    instant_assert(all(isinstance(i, str) for i in x), "In instant.build_module: Expecting sequence of strings.")
+    instant_assert(all(isinstance(i, string_types) for i in x), "In instant.build_module: Expecting sequence of strings.")
 
 
 def strip_strings(x):
@@ -53,7 +56,7 @@ def strip_strings(x):
 
 
 def arg_strings(x):
-    if isinstance(x, str):
+    if isinstance(x, string_types):
         x = x.split()
     return strip_strings(x)
 
@@ -109,7 +112,7 @@ def recompile(modulename, module_path, new_compilation_checksum,
     # Check if the old checksum matches the new one
     compilation_checksum_filename = "%s.checksum" % modulename
     if os.path.exists(compilation_checksum_filename):
-        checksum_file = open(compilation_checksum_filename)
+        checksum_file = io.open(compilation_checksum_filename, encoding="utf8")
         old_compilation_checksum = checksum_file.readline()
         checksum_file.close()
         if old_compilation_checksum == new_compilation_checksum:
@@ -119,7 +122,6 @@ def recompile(modulename, module_path, new_compilation_checksum,
     compile_log_filename = os.path.join(module_path, "compile.log")
     compile_log_filename_dest = os.path.join(get_default_error_dir(), \
                                              modulename, "compile.log")
-    compile_log_file = open(compile_log_filename, "w")
 
     ret = 1
     try:
@@ -134,8 +136,7 @@ def recompile(modulename, module_path, new_compilation_checksum,
             cmd = python_interp + " setup.py build_ext install --install-platlib=."
             instant_debug("cmd = %s" % cmd)
             ret, output = get_status_output(cmd)
-            compile_log_file.write(output)
-            compile_log_file.flush()
+            write_file(compile_log_filename, output)
             if ret != 0:
                 compile_log_contents = output
                 if os.path.exists(compilation_checksum_filename):
@@ -148,8 +149,7 @@ def recompile(modulename, module_path, new_compilation_checksum,
             #cmd = "cmake .";
             instant_debug("cmd = %s" % cmd)
             ret, output = get_status_output(cmd)
-            compile_log_file.write(output)
-            compile_log_file.flush()
+            write_file(compile_log_filename, output)
             if ret != 0:
                 compile_log_contents = output
                 if os.path.exists(compilation_checksum_filename):
@@ -161,8 +161,7 @@ def recompile(modulename, module_path, new_compilation_checksum,
             cmd = "make VERBOSE=1"
             instant_debug("cmd = %s" % cmd)
             ret, output = get_status_output(cmd)
-            compile_log_file.write(output)
-            compile_log_file.flush()
+            write_file(compile_log_filename, output, mode="a")
             if ret != 0:
                 compile_log_contents = output
                 if os.path.exists(compilation_checksum_filename):
@@ -171,7 +170,6 @@ def recompile(modulename, module_path, new_compilation_checksum,
                 instant_error(msg % (cmd, compile_log_filename_dest))
 
     finally:
-        compile_log_file.close()
         if ret != 0:
             if "INSTANT_DISPLAY_COMPILE_LOG" in list(os.environ.keys()):
                 instant_warning("")
@@ -226,8 +224,9 @@ def copy_to_cache(module_path, cache_dir, modulename,
         # empty file finished_copying
         try:
             shutil.copytree(module_path, cache_module_path)
-            open(os.path.join(cache_module_path,
-                              "finished_copying"), "w").close()
+            with io.open(os.path.join(cache_module_path, "finished_copying"),
+                             "w", encoding="utf8") as dummy:
+                pass            
         except OSError as e:
             if e.errno != errno.EEXIST:
                 raise
@@ -360,7 +359,7 @@ def build_module(modulename=None, source_directory=".",
     if sys.version_info[0] > 2:
         swigargs = swigargs + ['-py3']
 
-    instant_assert(modulename is None or isinstance(modulename, str),
+    instant_assert(modulename is None or isinstance(modulename, string_types),
         "In instant.build_module: Expecting modulename to be string or None.")
     assert_is_str(source_directory)
     source_directory = os.path.abspath(source_directory)
@@ -386,7 +385,7 @@ def build_module(modulename=None, source_directory=".",
     cmake_packages   = strip_strings(cmake_packages)
 
     instant_assert(signature is None \
-                   or isinstance(signature, str) \
+                   or isinstance(signature, string_types) \
                    or hasattr(signature, "signature"), "In instant.build_module: Expecting modulename to be string or None.")
 
     instant_assert(not (signature is not None and modulename is not None), "In instant.build_module: Can't have both modulename and signature.")
diff --git a/instant/codegeneration.py b/instant/codegeneration.py
index d780d7c..692d7b4 100644
--- a/instant/codegeneration.py
+++ b/instant/codegeneration.py
@@ -23,7 +23,7 @@
 # Alternatively, Instant may be distributed under the terms of the BSD license.
 
 import sys
-import re, os
+import re, os, io
 from .output import instant_assert, instant_warning, instant_debug, write_file
 from .config import get_swig_binary
 
@@ -281,7 +281,7 @@ def _test_write_interfacefile():
     write_interfacefile("%s.i" % modulename, modulename, code, init_code, \
                         additional_definitions, additional_declarations, \
                         system_headers, local_headers, wrap_headers, arrays)
-    print("".join(open("%s.i" % modulename).readlines()))
+    print("".join(io.open("%s.i" % modulename, encoding="utf8").readlines()))
 
 def _test_write_setup():
     modulename = "testmodule"
@@ -299,7 +299,7 @@ def _test_write_setup():
     write_setup("setup.py", modulename, csrcs, cppsrcs, local_headers, \
                 include_dirs, library_dirs, libraries, swig_include_dirs, \
                 swigargs, cppargs, lddargs)
-    print("".join(open("setup.py").readlines()))
+    print("".join(io.open("setup.py", encoding="utf8").readlines()))
 
 def unique(sequence):
     return list(set(sequence))
@@ -380,6 +380,8 @@ ENDIF(%(package)s_FOUND)
 
     cmake_form = dict(module_name=module_name)
 
+    cmake_form["python_executable"] = sys.executable
+
     cmake_form["extra_libraries"] = ";".join(libraries)
     cmake_form["extra_include_dirs"] = ";".join(include_dirs)
     cmake_form["extra_library_dirs"] = ";".join(library_dirs)
@@ -453,6 +455,8 @@ set (NAME %(module_name)s)
 
 PROJECT(${NAME})
 
+set(PYTHON_EXECUTABLE %(python_executable)s)
+
 %(find_packages)s
 
 %(cppargs)s
@@ -600,9 +604,8 @@ swig_link_libraries(${SWIG_MODULE_NAME} ${PYTHON_LIBRARIES} ${VTK_LIBS})
 
     """ % { "name" : name }
 
-    f = open("CMakeLists.txt", 'w')
-
-    f.write(file_template)
+    with io.open("CMakeLists.txt", 'w', encoding="utf8") as f:
+        f.write(file_template)
 
 
 def write_vmtk_cmakefile(name):
@@ -677,16 +680,16 @@ swig_link_libraries(${SWIG_MODULE_NAME} ${PYTHON_LIBRARIES} ${VTK_LIBS} ${VMTK_L
 
     """ % { "name" : name }
 
-    f = open("CMakeLists.txt", 'w')
+    with io.open("CMakeLists.txt", 'w', encoding="utf8") as f:
+        f.write(file_template)
 
-    f.write(file_template)
 
 def write_vtk_interface_file(signature, code):
     filename = signature
     ifile = filename + ".i"
-    iff = open(ifile, 'w')
     ifile_code = generate_interface_file_vtk(signature, code)
-    iff.write(ifile_code)
+    with io.open(ifile, 'w', encoding="utf8") as iff:
+        iff.write(ifile_code)
 
 
 if __name__ == "__main__":
diff --git a/instant/output.py b/instant/output.py
index a983896..7c583da 100644
--- a/instant/output.py
+++ b/instant/output.py
@@ -21,7 +21,7 @@
 # Alternatively, Instant may be distributed under the terms of the BSD license.
 
 from six import string_types
-import logging, os, platform, sys
+import io, logging, os, platform, sys
 
 # Logging wrappers
 _log = logging.getLogger("instant")
@@ -106,12 +106,14 @@ def instant_assert(condition, *message):
 # Utility functions for file handling:
 
 
-def write_file(filename, text):
+def write_file(filename, text, mode="w"):
     "Write text to a file and close it."
     try:
-        f = open(filename, "w")
-        f.write(text)
-        f.close()
+        if isinstance(text, bytes):
+            text = text.decode("utf8")
+        with io.open(filename, mode, encoding="utf8") as f:
+            f.write(text)
+            f.flush()
     except IOError as e:
         instant_error("Can't open '%s': %s" % (filename, e))
 
diff --git a/instant/signatures.py b/instant/signatures.py
index 9598d7e..4935c77 100644
--- a/instant/signatures.py
+++ b/instant/signatures.py
@@ -20,6 +20,7 @@
 # Alternatively, Instant may be distributed under the terms of the BSD license.
 
 from six import string_types
+import io
 import hashlib
 from .output import instant_assert, instant_debug, instant_error
 
@@ -38,7 +39,7 @@ def compute_checksum(text="", filenames=[]):
     for filename in sorted(filenames): 
         instant_debug("Adding file '%s' to checksum." % filename)
         try:
-            fp = open(filename, 'rb')
+            fp = io.open(filename, 'rb')
         except IOError as e:
             instant_error("Can't open file '%s': %s" % (filename, e))
         
diff --git a/setup.py b/setup.py
index cb58118..a5464d0 100755
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-import sys, platform, re
+import sys, platform
 from os.path import join, split, pardir
 
 try:
@@ -28,8 +28,7 @@ if platform.system() == "Windows" or "bdist_wininst" in sys.argv:
         batch_files.append(batch_file)
     scripts.extend(batch_files)
 
-version = re.findall('__version__ = "(.*)"',
-                     open('instant/__init__.py', 'r').read())[0]
+version = "2017.1.0"
 
 url = "https://bitbucket.org/fenics-project/instant/"
 tarball = None

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/fenics/instant.git



More information about the debian-science-commits mailing list