diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index 1156547ca..af8a9eb0c 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -91,7 +91,7 @@ jobs: run: | mkdir installer cp gambit* installer - "${WIX}bin/candle" gambit.wxs + "${WIX}bin/candle" build_support/msw/gambit.wxs "${WIX}bin/light" -ext WixUIExtension gambit.wixobj - uses: actions/upload-artifact@v5 with: diff --git a/Makefile.am b/Makefile.am index efa5463ba..95b2ed961 100644 --- a/Makefile.am +++ b/Makefile.am @@ -23,11 +23,9 @@ ACLOCAL_AMFLAGS = -I m4 EXTRA_DIST = \ - gambit.spec \ - gambit.desktop \ - gambit.wxs \ - contrib/mac/Info.plist \ - contrib/mac/gambit.icns \ + build_support/msw/gambit.wxs.in \ + build_support/osx/Info.plist.in \ + build_support/osx/gambit.icns \ src/labenski/README.txt \ src/labenski/art/grab.xpm \ src/labenski/art/hand.xpm \ @@ -374,9 +372,12 @@ if WITH_GUI bin_PROGRAMS += gambit endif -EXTRA_PROGRAMS = gambit-enumpoly gambit +# Read version from GAMBIT_VERSION file for use in compilation +GAMBIT_VERSION = $(shell cat $(top_srcdir)/build_support/GAMBIT_VERSION) + +# Define VERSION for all C++ compilations and set include paths +AM_CPPFLAGS = -I$(top_srcdir)/src -DVERSION=\"$(GAMBIT_VERSION)\" -AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/labenski/include ${WX_CXXFLAGS} AM_CXXFLAGS = ${LLVM_CXXFLAGS} ## Command-line tools @@ -604,6 +605,9 @@ gambit_SOURCES = \ src/gui/valnumber.cc \ src/gui/valnumber.h +# Add wxWidgets compilation flags for the GUI program +gambit_CXXFLAGS = $(AM_CXXFLAGS) $(WX_CXXFLAGS) +gambit_CPPFLAGS = $(AM_CPPFLAGS) $(WX_CXXFLAGS) -I$(top_srcdir)/src/labenski/include if IS_WIN32 gambit_LDADD = $(RC_OBJECT_PATH) $(WX_LIBS_STATIC) -ldeflate -lzstd -llerc -lWebP @@ -619,8 +623,8 @@ osx-bundle: -mkdir Gambit.app/Contents -mkdir Gambit.app/Contents/MacOS -mkdir Gambit.app/Contents/Resources - cp ${top_srcdir}/contrib/mac/Info.plist Gambit.app/Contents - cp ${top_srcdir}/contrib/mac/gambit.icns Gambit.app/Contents/Resources/gambit.icns + cp build_support/osx/Info.plist Gambit.app/Contents + cp ${top_srcdir}/build_support/osx/gambit.icns Gambit.app/Contents/Resources/gambit.icns echo -n 'APPL????' > Gambit.app/Contents/PkgInfo cp gambit Gambit.app/Contents/MacOS/gambit cp ${bin_PROGRAMS} Gambit.app/Contents/MacOS @@ -635,11 +639,11 @@ osx-dmg: osx-bundle msw-msi: -mkdir installer cp gambit* installer - candle gambit.wxs + candle build_support/msw/gambit.wxs light -ext WixUIExtension gambit.wixobj clang-tidy: - clang-tidy ${top_srcdir}/src/core/*.cc -- --std=c++17 -I ${top_srcdir}/src -DVERSION="" - clang-tidy ${top_srcdir}/src/games/*.cc ${top_srcdir}/src/games/*/*.cc -- --std=c++17 -I ${top_srcdir}/src -DVERSION="" - clang-tidy ${top_srcdir}/src/solvers/*/*.cc -- --std=c++17 -I ${top_srcdir}/src -DVERSION="" - clang-tidy ${top_srcdir}/src/tools/*/*.cc -- --std=c++17 -I ${top_srcdir}/src -DVERSION="" + clang-tidy ${top_srcdir}/src/core/*.cc -- --std=c++17 -I ${top_srcdir}/src -DVERSION=\"$(GAMBIT_VERSION)\" + clang-tidy ${top_srcdir}/src/games/*.cc ${top_srcdir}/src/games/*/*.cc -- --std=c++17 -I ${top_srcdir}/src -DVERSION=\"$(GAMBIT_VERSION)\" + clang-tidy ${top_srcdir}/src/solvers/*/*.cc -- --std=c++17 -I ${top_srcdir}/src -DVERSION=\"$(GAMBIT_VERSION)\" + clang-tidy ${top_srcdir}/src/tools/*/*.cc -- --std=c++17 -I ${top_srcdir}/src -DVERSION=\"$(GAMBIT_VERSION)\" diff --git a/build_support/GAMBIT_VERSION b/build_support/GAMBIT_VERSION new file mode 100644 index 000000000..29b7b9ad9 --- /dev/null +++ b/build_support/GAMBIT_VERSION @@ -0,0 +1 @@ +16.4.0 diff --git a/gambit.wxs b/build_support/msw/gambit.wxs.in similarity index 96% rename from gambit.wxs rename to build_support/msw/gambit.wxs.in index 7563a8404..85f20db32 100644 --- a/gambit.wxs +++ b/build_support/msw/gambit.wxs.in @@ -1,6 +1,6 @@ - + diff --git a/contrib/mac/Info.plist b/build_support/osx/Info.plist.in similarity index 91% rename from contrib/mac/Info.plist rename to build_support/osx/Info.plist.in index a17bd7905..6aa5c91f1 100644 --- a/contrib/mac/Info.plist +++ b/build_support/osx/Info.plist.in @@ -19,13 +19,13 @@ CFBundleSignature ???? CFBundleVersion - 16.4.0 + @GAMBIT_VERSION@ CFBundleShortVersionString - 16.4.0 + @GAMBIT_VERSION@ CFBundleGetInfoString - Gambit version 16.4.0, (c) 1994-2025 The Gambit Project + Gambit version @GAMBIT_VERSION@, (c) 1994-2025 The Gambit Project CFBundleLongVersionString - 16.4.0, (c) 1994-2025 The Gambit Project + @GAMBIT_VERSION@, (c) 1994-2025 The Gambit Project NSHumanReadableCopyright Copyright 1994-2025 The Gambit Project LSRequiresCarbon diff --git a/contrib/mac/gambit.icns b/build_support/osx/gambit.icns similarity index 100% rename from contrib/mac/gambit.icns rename to build_support/osx/gambit.icns diff --git a/configure.ac b/configure.ac index e0170be0b..de65a299e 100644 --- a/configure.ac +++ b/configure.ac @@ -20,7 +20,7 @@ dnl along with this program; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. dnl -AC_INIT([gambit],[16.4.0]) +AC_INIT([gambit],[m4_esyscmd_s([cat build_support/GAMBIT_VERSION])]) AC_CONFIG_SRCDIR([src/gambit.h]) AM_INIT_AUTOMAKE([subdir-objects foreign]) dnl AC_CONFIG_MACRO_DIR([m4]) @@ -145,5 +145,8 @@ AC_SUBST(WX_CXXFLAGS) REZFLAGS=`echo $CXXFLAGS $WX_CXXFLAGS | sed 's/-mthreads//g' | sed 's/-g//g' | sed 's/-O. / /g' | sed 's/-I/--include-dir /g'` AC_SUBST(REZFLAGS) -AC_CONFIG_FILES([Makefile]) +GAMBIT_VERSION=`cat build_support/GAMBIT_VERSION` +AC_SUBST(GAMBIT_VERSION) + +AC_CONFIG_FILES([Makefile build_support/osx/Info.plist build_support/msw/gambit.wxs]) AC_OUTPUT diff --git a/doc/conf.py b/doc/conf.py index 21b5325ba..4079391de 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -1,3 +1,5 @@ +import pathlib + # # Gambit documentation build configuration file, created by # sphinx-quickstart on Sun Mar 21 14:35:06 2010. @@ -53,10 +55,17 @@ # |version| and |release|, also used in various other places throughout the # built documents. # -# The short X.Y version. -version = "16.4" -# The full version, including alpha/beta/rc tags. -release = "16.4.0" + +_version_file = pathlib.Path(__file__).parent.parent / "build_support/GAMBIT_VERSION" +if _version_file.exists(): + _full_version = _version_file.read_text().strip() + # The short X.Y version. + version = ".".join(_full_version.split(".")[:2]) + # The full version, including alpha/beta/rc tags. + release = _full_version +else: + # Throw error if GAMBIT_VERSION file not found + raise FileNotFoundError("GAMBIT_VERSION file not found") # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/doc/developer.contributing.rst b/doc/developer.contributing.rst index ce4f809c0..0abab8744 100644 --- a/doc/developer.contributing.rst +++ b/doc/developer.contributing.rst @@ -160,3 +160,60 @@ To add a contributor, comment on a GitHub Issue or Pull Request, asking @all-con @all-contributors please add @ for Refer to the `emoji key `__ for a list of contribution types. + +Releases & maintenance branches +------------------------------- + +Releases of Gambit are made by core developers. +Details of previous releases can be found in the `GitHub releases page `__. + +Branches labeled ``maintX`` and ``maintX_Y``, where ``X`` is the major version number and ``Y`` is the minor version number, are associated with releases and point to the latest commit on a stable version. +Navigate to the Gambit repository on GitHub and select the `branches` tab to see the list of active maintenance branches. +Be sure to delete any maintenance branches that are no longer being maintained. + +.. _making-a-new-release: + +Making a new release +^^^^^^^^^^^^^^^^^^^^ + +When making a new release of Gambit, follow these steps: + +1. Create a new branch from the latest commit on the ``master`` branch named ``maintX_Y``, where ``X`` is the major version number and ``Y`` is the minor version number of the new release. + +2. Update the version number in the ``build_support/GAMBIT_VERSION`` file to ``X.Y.Z``. + + All other files will automatically use the updated version number: + + - `pyproject.toml` reads from GAMBIT_VERSION file at build time + - `configure.ac` reads from GAMBIT_VERSION file and substitutes into `build_support/osx/Info.plist` and `build_support/msw/gambit.wxs` + - `src/pygambit/__init__.py` reads from installed package metadata or GAMBIT_VERSION file + - `doc/conf.py` reads from GAMBIT_VERSION file at documentation build time + - Documentation pages reference the `|release|` substitution variable to automatically reflect the updated version number. + +3. Update the `ChangeLog` file with a summary of changes + +4. Once there are no further commits to be made for the release, create a tag for the release from the latest commit on the maintenance branch. :: + + git tag -a vX.Y.Z -m "Gambit version X.Y.Z" + +5. Push the maintenance branch and tags to the GitHub repository. :: + + git push origin maintX_Y + git push origin --tags + +6. Create a new release on the `GitHub releases page `__, using the tag created in step 4. + Include a summary of changes from the `ChangeLog` file in the release notes. + +7. Currently there is no automated process for pushing the new release to PyPI. This must be done manually. + +.. TODO: update this process to be automated via GitHub Actions: Issue #557 + +Patching maintained versions +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +If you have bug fixes that should be applied across maintained versions: + +1. Make a branch from the oldest maintenance branch to which the change applies +2. Apply the change and make a pull request to that maintenance branch +3. After the pull request is merged, open new pull requests to each subsequent maintenance branch and finally to the master branch, merging each in turn +4. Create new releases from each maintenance branch as needed, following the steps in :ref:`making-a-new-release`. diff --git a/doc/tools.convert.rst b/doc/tools.convert.rst index 7db467c7c..730e92849 100644 --- a/doc/tools.convert.rst +++ b/doc/tools.convert.rst @@ -36,11 +36,11 @@ outputting the strategic form of the game in one of these formats: Suppresses printing of the banner at program launch. -Example invocation for HTML output:: +Example invocation for HTML output $ gambit-convert -O html 2x2.nfg Convert games among various file formats - Gambit version 16.4.0, Copyright (C) 1994-2025, The Gambit Project + Gambit version |release|, Copyright (C) 1994-2025, The Gambit Project This is free software, distributed under the GNU GPL

Two person 2 x 2 game with unique mixed equilibrium

@@ -51,11 +51,11 @@ Example invocation for HTML output:: align=center>1,0 -Example invocation for LaTeX output:: +Example invocation for LaTeX output $ gambit-convert -O sgame 2x2.nfg Convert games among various file formats - Gambit version 16.4.0, Copyright (C) 1994-2025, The Gambit Project + Gambit version |release|, Copyright (C) 1994-2025, The Gambit Project This is free software, distributed under the GNU GPL \begin{game}{2}{2}[Player 1][Player 2] diff --git a/doc/tools.enummixed.rst b/doc/tools.enummixed.rst index 8a2432672..ebed02d1b 100644 --- a/doc/tools.enummixed.rst +++ b/doc/tools.enummixed.rst @@ -66,11 +66,11 @@ points. Computing the equilibria, in mixed strategies, of :download:`e02.nfg <../contrib/games/e02.nfg>`, the reduced strategic form of the example in Figure 2 of Selten (International Journal of Game Theory, -1975):: +1975) $ gambit-enummixed e02.nfg Compute Nash equilibria by enumerating extreme points - Gambit version 16.4.0, Copyright (C) 1994-2025, The Gambit Project + Gambit version |release|, Copyright (C) 1994-2025, The Gambit Project This is free software, distributed under the GNU GPL NE,1,0,0,1,0 @@ -78,11 +78,11 @@ in Figure 2 of Selten (International Journal of Game Theory, In fact, the game e02.nfg has a one-dimensional continuum of equilibria. This fact can be observed by examining the connectedness -information using the `-c` switch:: +information using the `-c` switch $ gambit-enummixed -c e02.nfg Compute Nash equilibria by enumerating extreme points - Gambit version 16.4.0, Copyright (C) 1994-2025, The Gambit Project + Gambit version |release|, Copyright (C) 1994-2025, The Gambit Project This is free software, distributed under the GNU GPL NE,1,0,0,1,0 diff --git a/doc/tools.enumpoly.rst b/doc/tools.enumpoly.rst index f3c46bd9a..ce627080b 100644 --- a/doc/tools.enumpoly.rst +++ b/doc/tools.enumpoly.rst @@ -94,11 +94,11 @@ support of some set of equilibria. Computing equilibria of the strategic game :download:`e01.nfg <../contrib/games/e01.efg>`, the example in Figure 1 of Selten (International Journal of Game Theory, 1975) sometimes called -"Selten's horse":: +"Selten's horse" $ gambit-enumpoly e01.nfg Compute Nash equilibria by solving polynomial systems - Gambit version 16.4.0, Copyright (C) 1994-2025, The Gambit Project + Gambit version |release|, Copyright (C) 1994-2025, The Gambit Project This is free software, distributed under the GNU GPL NE,1.000000,0.000000,1.000000,0.000000,0.000000,1.000000 diff --git a/doc/tools.enumpure.rst b/doc/tools.enumpure.rst index f9dfafc9e..3dea415e3 100644 --- a/doc/tools.enumpure.rst +++ b/doc/tools.enumpure.rst @@ -54,33 +54,37 @@ pure-strategy Nash equilibria. Computing the pure-strategy equilibria of extensive game :download:`e02.efg <../contrib/games/e02.efg>`, the example in Figure 2 of Selten -(International Journal of Game Theory, 1975):: +(International Journal of Game Theory, 1975) $ gambit-enumpure e02.efg + Search for Nash equilibria in pure strategies - Gambit version 16.4.0, Copyright (C) 1994-2025, The Gambit Project + + Gambit version |release|, Copyright (C) 1994-2025, The Gambit Project + This is free software, distributed under the GNU GPL NE,1,0,0,0,1,0 With the `-S` switch, the set of equilibria returned is the same, except expressed in strategic game strategies rather than behavior -strategies:: +strategies $ gambit-enumpure -S e02.efg + Search for Nash equilibria in pure strategies - Gambit version 16.4.0, Copyright (C) 1994-2025, The Gambit Project + Gambit version |release|, Copyright (C) 1994-2025, The Gambit Project This is free software, distributed under the GNU GPL NE,1,0,0,1,0 The `-A` switch considers only behavior strategy profiles where there is no way for a player to improve his payoff by changing action at -only one information set; therefore the set of solutions is larger:: +only one information set; therefore the set of solutions is larger $ gambit-enumpure -A e02.efg Search for Nash equilibria in pure strategies - Gambit version 16.4.0, Copyright (C) 1994-2025, The Gambit Project + Gambit version |release|, Copyright (C) 1994-2025, The Gambit Project This is free software, distributed under the GNU GPL NE,1,0,1,0,1,0 diff --git a/doc/tools.gnm.rst b/doc/tools.gnm.rst index 88ca23eb4..d992074f2 100644 --- a/doc/tools.gnm.rst +++ b/doc/tools.gnm.rst @@ -83,15 +83,15 @@ subsets of equilibria being found. Computing an equilibrium of :download:`e02.nfg <../contrib/games/e02.nfg>`, the reduced strategic form of the example in Figure 2 of Selten -(International Journal of Game Theory, 1975):: +(International Journal of Game Theory, 1975) - $ gambit-gnm e02.nfg - Compute Nash equilibria using a global Newton method - Gametracer version 0.2, Copyright (C) 2002, Ben Blum and Christian Shelton - Gambit version 16.4.0, Copyright (C) 1994-2025, The Gambit Project - This is free software, distributed under the GNU GPL + $ gambit-gnm e02.nfg - NE,1,0,2.99905e-12,0.5,0.5 + Compute Nash equilibria using a global Newton method + Gametracer version 0.2, Copyright (C) 2002, Ben Blum and Christian Shelton + Gambit version |release|, Copyright (C) 1994-2025, The Gambit Project + This is free software, distributed under the GNU GPL + NE,1,0,2.99905e-12,0.5,0.5 .. seealso:: diff --git a/doc/tools.ipa.rst b/doc/tools.ipa.rst index 219faa95b..6bc1b8227 100644 --- a/doc/tools.ipa.rst +++ b/doc/tools.ipa.rst @@ -50,12 +50,13 @@ equilibria being found. Computing an equilibrium of :download:`e02.nfg <../contrib/games/e02.nfg>`, the reduced strategic form of the example in Figure 2 of Selten -(International Journal of Game Theory, 1975):: +(International Journal of Game Theory, 1975) $ gambit-ipa e02.nfg + Compute Nash equilibria using iterated polymatrix approximation Gametracer version 0.2, Copyright (C) 2002, Ben Blum and Christian Shelton - Gambit version 16.4.0, Copyright (C) 1994-2025, The Gambit Project + Gambit version |release|, Copyright (C) 1994-2025, The Gambit Project This is free software, distributed under the GNU GPL NE,1.000000,0.000000,0.000000,1.000000,0.000000 diff --git a/doc/tools.lcp.rst b/doc/tools.lcp.rst index 62eb424f5..4de443aa7 100644 --- a/doc/tools.lcp.rst +++ b/doc/tools.lcp.rst @@ -68,11 +68,11 @@ game. Computing an equilibrium of extensive game :download:`e02.efg <../contrib/games/e02.efg>`, the example in Figure 2 of Selten -(International Journal of Game Theory, 1975):: +(International Journal of Game Theory, 1975) $ gambit-lcp e02.efg Compute Nash equilibria by solving a linear complementarity program - Gambit version 16.4.0, Copyright (C) 1994-2025, The Gambit Project + Gambit version |release|, Copyright (C) 1994-2025, The Gambit Project This is free software, distributed under the GNU GPL NE,1,0,1/2,1/2,1/2,1/2 diff --git a/doc/tools.liap.rst b/doc/tools.liap.rst index 561059d45..0203d7d01 100644 --- a/doc/tools.liap.rst +++ b/doc/tools.liap.rst @@ -81,11 +81,11 @@ not guaranteed to find all, or even any, Nash equilibria. Computing an equilibrium in mixed strategies of :download:`e02.efg <../contrib/games/e02.efg>`, the example in Figure 2 of Selten -(International Journal of Game Theory, 1975):: +(International Journal of Game Theory, 1975) $ gambit-liap e02.nfg Compute Nash equilibria by minimizing the Lyapunov function - Gambit version 16.4.0, Copyright (C) 1994-2025, The Gambit Project + Gambit version |release|, Copyright (C) 1994-2025, The Gambit Project This is free software, distributed under the GNU GPL NE,0.998701,0.000229,0.001070,0.618833,0.381167 diff --git a/doc/tools.logit.rst b/doc/tools.logit.rst index 59eaf7e52..009cceb97 100644 --- a/doc/tools.logit.rst +++ b/doc/tools.logit.rst @@ -104,11 +104,11 @@ the beliefs at such information sets as being uniform across all member nodes. Computing the principal branch, in mixed strategies, of :download:`e02.nfg <../contrib/games/e02.nfg>`, the reduced strategic form of the example in Figure 2 of Selten (International Journal of Game Theory, -1975):: +1975) $ gambit-logit e02.nfg Compute a branch of the logit equilibrium correspondence - Gambit version 16.4.0, Copyright (C) 1994-2025, The Gambit Project + Gambit version |release|, Copyright (C) 1994-2025, The Gambit Project This is free software, distributed under the GNU GPL 0.000000,0.333333,0.333333,0.333333,0.5,0.5 diff --git a/doc/tools.lp.rst b/doc/tools.lp.rst index efa47563d..e34493bc2 100644 --- a/doc/tools.lp.rst +++ b/doc/tools.lp.rst @@ -54,11 +54,11 @@ points of that set. Computing an equilibrium of the game :download:`2x2const.nfg <../contrib/games/2x2const.nfg>`, a game with two players with two -strategies each, with a unique equilibrium in mixed strategies:: +strategies each, with a unique equilibrium in mixed strategies $ gambit-lp 2x2const.nfg Compute Nash equilibria by solving a linear program - Gambit version 16.4.0, Copyright (C) 1994-2025, The Gambit Project + Gambit version |release|, Copyright (C) 1994-2025, The Gambit Project This is free software, distributed under the GNU GPL NE,1/3,2/3,1/3,2/3 diff --git a/doc/tools.simpdiv.rst b/doc/tools.simpdiv.rst index 324025dd6..092631be9 100644 --- a/doc/tools.simpdiv.rst +++ b/doc/tools.simpdiv.rst @@ -88,11 +88,11 @@ options to specify additional starting points for the algorithm. Computing an equilibrium in mixed strategies of :download:`e02.efg <../contrib/games/e02.efg>`, the example in Figure 2 of Selten -(International Journal of Game Theory, 1975):: +(International Journal of Game Theory, 1975) $ gambit-simpdiv e02.nfg Compute Nash equilibria using simplicial subdivision - Gambit version 16.4.0, Copyright (C) 1994-2025, The Gambit Project + Gambit version |release|, Copyright (C) 1994-2025, The Gambit Project This is free software, distributed under the GNU GPL NE,1,0,0,1,0 diff --git a/gambit.desktop b/gambit.desktop deleted file mode 100644 index 9dded8d06..000000000 --- a/gambit.desktop +++ /dev/null @@ -1,9 +0,0 @@ -[Desktop Entry] -Version=1.0 -Encoding=UTF-8 -Name=Gambit Game Analysis -Comment=Construction and analysis of finite extensive and strategic games -Exec=gambit -Icon=gambit -Type=Application -Categories=Math;Science; diff --git a/gambit.spec b/gambit.spec deleted file mode 100644 index 641442d5a..000000000 --- a/gambit.spec +++ /dev/null @@ -1,56 +0,0 @@ -Summary: Gambit Game Theory Tools -Name: gambit -Version: 0.2006.01.20 -Release: 1 -License: GPL -Group: Applications -URL: http://econweb.tamu.edu/gambit -Source0: %{name}-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot - -%description -Gambit is a collection of tools for interactively building and -analyzing finite games. - -%prep -%setup -q -%configure - -%build -make - -%install -%makeinstall - -mkdir -p $RPM_BUILD_ROOT%{_datadir}/gambit -cp -R efg $RPM_BUILD_ROOT%{_datadir}/gambit -cp -R nfg $RPM_BUILD_ROOT%{_datadir}/gambit - -%clean -rm -rf $RPM_BUILD_ROOT - -%files -%defattr(-,root,root) -%doc AUTHORS ChangeLog COPYING INSTALL NEWS README -%{_bindir}/gambit* -%{_libdir}/libgambit* -%{_libdir}/liblab* -%{_includedir}/libgambit* -%{_datadir}/gambit - - -%changelog -* Tue Dec 13 2005 Ted Turocy -- adding to main distribution; tweak descriptions - -* Mon Dec 12 2005 Paul E. Johnson -- version bump & reorganization - -* Tue Apr 06 2004 Paul E. Johnson -- version bump. - -* Wed Mar 10 2004 Christopher C. Weis -- cleaned up spec file to use macros and proper file inclusions - -* Thu Oct 23 2003 Paul E. Johnson -- Initial build. diff --git a/pyproject.toml b/pyproject.toml index fb4f80b43..5f010358b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "pygambit" -version = "16.4.0" +dynamic = ["version"] description = "The package for computation in game theory" readme = "src/README.rst" requires-python = ">=3.9" @@ -84,3 +84,6 @@ markers = [ "nash: all tests of Nash equilibrium solvers", "slow: all time-consuming tests", ] + +[tool.setuptools.dynamic] +version = {file = "build_support/GAMBIT_VERSION"} diff --git a/src/pygambit/__init__.py b/src/pygambit/__init__.py index 7c7607874..727ddf721 100644 --- a/src/pygambit/__init__.py +++ b/src/pygambit/__init__.py @@ -28,4 +28,12 @@ supports, # noqa: F401 ) -__version__ = "16.4.0" +import importlib.metadata + +try: + __version__ = importlib.metadata.version("pygambit") +except importlib.metadata.PackageNotFoundError: + # Package is not installed, fallback to reading GAMBIT_VERSION file + import pathlib + _version_file = pathlib.Path(__file__).parent.parent.parent / "build_support/GAMBIT_VERSION" + __version__ = _version_file.read_text().strip() if _version_file.exists() else "unknown"