diff --git a/.bumpversion.cfg b/.bumpversion.cfg deleted file mode 100644 index c3bd180..0000000 --- a/.bumpversion.cfg +++ /dev/null @@ -1,8 +0,0 @@ -[bumpversion] -current_version = 2.0.0 -commit = True -tag = True - -[bumpversion:file:craft_grammar/__init__.py] -search = __version__ = "{current_version}" -replace = __version__ = "{new_version}" diff --git a/craft_grammar/__init__.py b/craft_grammar/__init__.py index 702986c..997db83 100644 --- a/craft_grammar/__init__.py +++ b/craft_grammar/__init__.py @@ -14,11 +14,7 @@ # You should have received a copy of the GNU Lesser General Public License # along with this program; if not, write to the Free Software Foundation, # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -"""Enhance part definitions with advanced grammar.""" - -__version__ = "2.0.0" - +"""Enhance project definitions with advanced grammar.""" from . import errors from ._compound import CompoundStatement @@ -29,7 +25,18 @@ from ._try import TryStatement from .create import create_grammar_model +try: + from ._version import __version__ +except ImportError: # pragma: no cover + from importlib.metadata import version, PackageNotFoundError + + try: + __version__ = version("craft-grammar") + except PackageNotFoundError: + __version__ = "dev" + __all__ = [ + "__version__", "errors", "CallStack", "CompoundStatement",