Ejemplo n.º 1
0
def test_release(tmpdir, monkeypatch, ver_string):
    ver, rev, ref, rel = ver_string
    monkeypatch.delenv(str('SVN_REVISION'), False)
    v = tmpdir.join('version.txt')
    v.write(ver)
    monkeypatch.setattr("sys.argv", (v.strpath, ))
    monkeypatch.setattr("subprocess.check_output", get_check_output(rev))
    probe = version.Version()
    if rel is not None:
        assert probe.release == rel
    monkeypatch.undo()
Ejemplo n.º 2
0
def test_ver_explicit_path_env(tmpdir, monkeypatch, ver_string):
    ver, rev, ref, rel = ver_string
    monkeypatch.setenv(str('SVN_REVISION'), rev)
    monkeypatch.setattr("subprocess.check_output", get_check_output("1:666"))
    v = tmpdir.join('version.txt')
    v.write(ver)
    probe = version.Version(v)
    if rel is not None:
        assert probe() == ref
    else:
        with pytest.raises(version.VersionError):
            probe()
    monkeypatch.undo()
Ejemplo n.º 3
0
def test_ver_explicit_path(tmpdir, monkeypatch, ver_string):
    svn_dir = tmpdir.join(".svn")
    if not svn_dir.isdir():
        svn_dir.mkdir()
    ver, rev, ref, rel = ver_string
    monkeypatch.delenv(str('SVN_REVISION'), False)
    monkeypatch.setattr("subprocess.check_output", get_check_output(rev))
    v = tmpdir.join('version.txt')
    v.write(ver)
    probe = version.Version(v)
    if rel is not None:
        assert probe() == ref
    else:
        with pytest.raises(version.VersionError):
            probe()
    monkeypatch.undo()
Ejemplo n.º 4
0
def test_parse_template(tmpdir, monkeypatch):
    svn_dir = tmpdir.join(".svn")
    if not svn_dir.isdir():
        svn_dir.mkdir()
    v = tmpdir.join('version.txt')
    monkeypatch.delenv(str('SVN_REVISION'), False)
    v.write("1.2.3")
    tmpl = tmpdir.join('parse_template_test.in')
    tmpl.write("""Just a test
{{ version }}\n
""")
    monkeypatch.setattr("sys.argv", (v.strpath, ))
    with v.dirpath().as_cwd():
        probe = version.Version()
        probe.parse_template(str(tmpl))
        assert tmpdir.join("parse_template_test").read() == '''\
Ejemplo n.º 5
0
def test_write(tmpdir, monkeypatch):
    svn_dir = tmpdir.join(".svn")
    if not svn_dir.isdir():
        svn_dir.mkdir()
    v = tmpdir.join('version.txt')
    v.write("1.2.3")
    monkeypatch.setattr("sys.argv", (v.strpath, ))
    with v.dirpath().as_cwd():
        probe = version.Version()
        probe.write(tmpdir.join("__version.py").strpath)
        assert tmpdir.join("__version.py").read() == '''\
# -*- coding: utf-8 -*-
# Automatically generated version file.
from __future__ import unicode_literals

__version__ = "1.2.3"
'''
    monkeypatch.undo()
Ejemplo n.º 6
0
def test_write_copyright_2(tmpdir, monkeypatch):
    svn_dir = tmpdir.join(".svn")
    if not svn_dir.isdir():
        svn_dir.mkdir()
    v = tmpdir.join('version.txt')
    v.write("1.2.3")
    monkeypatch.setattr("sys.argv", (v.strpath, ))
    with v.dirpath().as_cwd():
        probe = version.Version()
        probe.copyright = u'© today and "more"'
        probe.write(tmpdir.join("__version.py").strpath)
        assert codecs.open(
            tmpdir.join("__version.py").strpath, 'r',
            encoding='utf8').read() == u'''\
# -*- coding: utf-8 -*-
# Automatically generated version file.
from __future__ import unicode_literals

__version__ = "1.2.3"
__copyright__ = """© today and \\"more\\""""
'''
    monkeypatch.undo()
Ejemplo n.º 7
0
# Standard libraries.
import os
from setuptools import setup, find_packages

# DNV GL libraries.
import dnvgl.setup_utils.version as version

# ID: $Id$"
__date__ = "$Date$"[6:-1]
__version__ = "$Revision$"[10:-1]
__author__ = "`Berthold Höllmann <*****@*****.**>`__"
__copyright__ = "Copyright © 2010 by DNV GL SE"

INSTALL_REQUIRES = ['DNVGLPyFramework']

VERSION = version.Version("version.txt")
VERSION.write((os.path.join('dnvgl', 'fortran2cheader', '__version__.py'), ))

if __name__ == '__main__':
    setup(name='Fortran2CHeader',
          version=VERSION(),
          license='Other/Proprietary License',
          author='Berthold Höllmann, DNV GL SE',
          author_email='*****@*****.**',
          url='http://www.dnvgl.com',
          description='''
Generate a C/C++ header file from a Fortran source file using those
subroutines decorated with Fortran2003 `C_ISO_BINDINGS` `BIND` and
`C_*` types.  `INTERFACE` blocks are ignored to allow direct usage of
C function calls in the `FORTRAN` code.''',
          keywords='DNVGL Framework',