Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@

project = 'fparser'
copyright = '2017-2024, Science and Technology Facilities Council'
author = 'Andrew Porter, Rupert Ford, Balthasar Reuter, Joerg Henrichs and Pearu Peterson'
author = (
'Andrew Porter, Rupert Ford, Balthasar Reuter, Joerg Henrichs, '
'Sergi Siso and Pearu Peterson'
)

version = fparser._get_version()
release = fparser._get_version()
version = fparser.__version__
release = fparser.__version__

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
requires = [
"setuptools >= 61",
"setuptools_scm[toml] >= 6.2",
"setuptools_scm_git_archive",
"wheel >= 0.29.0",
]
build-backend = "setuptools.build_meta"
Expand All @@ -11,7 +10,8 @@ build-backend = "setuptools.build_meta"
name = "fparser"
authors = [{name = "Pearu Peterson"},
{name = "Rupert Ford"},
{name = "Andrew Porter", email = "andrew.porter@stfc.ac.uk"}]
{name = "Andrew Porter", email = "andrew.porter@stfc.ac.uk"},
{name = "Sergi Siso", email = "sergi.siso@stfc.ac.uk"}]
license = {text = "BSD-3-Clause"}
description = "Python implementation of a Fortran parser"
readme = "README.md"
Expand All @@ -33,7 +33,6 @@ classifiers = [
keywords = ["fortran", "parser"]
dynamic = ["version"]
requires-python = ">=3.6"
dependencies = ["setuptools_scm"]

[project.optional-dependencies]
doc = ["sphinx", "sphinxcontrib.bibtex", "autoapi", "sphinx-autoapi", "sphinx_rtd_theme"]
Expand Down
74 changes: 0 additions & 74 deletions setup.py

This file was deleted.

21 changes: 2 additions & 19 deletions src/fparser/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,28 +65,11 @@
# First version by: Pearu Peterson <pearu@cens.ioc.ee>
# First created: Oct 2006

from importlib.metadata import PackageNotFoundError
from importlib import metadata

import logging
import codecs
import fparser._version as v


def _get_version():
"""
:returns: the version of this package.
:rtype: str
"""
try:
return metadata.version(__name__)
except PackageNotFoundError:
# Package is not installed.
from setuptools_scm import get_version

return get_version(root="../..", relative_to=__file__)


__version__ = _get_version()
__version__ = v.version

logging.getLogger(__name__).addHandler(logging.NullHandler())

Expand Down
9 changes: 3 additions & 6 deletions src/fparser/scripts/fparser2.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,12 @@

import logging
import sys
from optparse import OptionParser
import fparser
from fparser.scripts.script_options import set_fparser_options

logging.basicConfig()

try:
from iocbio.optparse_gui import OptionParser
except ImportError:
from optparse import OptionParser


def runner(_, options, args):
"""
Expand Down Expand Up @@ -116,7 +113,7 @@ def runner(_, options, args):

def main():
"""Check arguments before parsing code"""
parser = OptionParser()
parser = OptionParser(version=fparser.__version__)
set_fparser_options(parser)
options, args = parser.parse_args()
runner(parser, options, args)
Expand Down
21 changes: 0 additions & 21 deletions src/fparser/tests/test_fparser_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,27 +38,6 @@
"""

import os
import fparser


def test_fparser_get_version(monkeypatch):
"""Test the _get_version() utility routine. It doesn't make sense to
actually check precisely which version it reports - just that it returns a
suitable string."""
ver1 = fparser._get_version()
assert isinstance(ver1, str)
assert "." in ver1

def _broken_version(_name):
"""Broken routine with which to patch the `version` method."""
raise fparser.PackageNotFoundError()

from importlib import metadata

monkeypatch.setattr(metadata, "version", _broken_version)
ver2 = fparser._get_version()
assert isinstance(ver2, str)
assert "." in ver2


def test_fparser_logging_handler(tmpdir, caplog):
Expand Down
4 changes: 2 additions & 2 deletions src/fparser/tests/test_issue8.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def test_reproduce_issue():
! 2, 3,..
! 3, 4,..
!
& ncore(nclass) ! ncore = \sum_l
& ncore(nclass) ! ncore = \\sum_l
! Number of diffe
end
"""
Expand All @@ -93,7 +93,7 @@ def test_reproduce_issue():
! 2, 3,..
! 3, 4,..
!
! ncore = \sum_l
! ncore = \\sum_l
! Number of diffe
END SUBROUTINE gwinput_v2x
"""
Expand Down
Loading