diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index ccd3d30bd0..4234eede0b 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -367,7 +367,8 @@ if VERSION is None: if RUNTIME: VERSION = PLUGIN_VERSION else: - VERSION = ParsePandaVersion("dtool/PandaVersion.pp") + # Take the value from the setup.cfg file. + VERSION = GetMetadataValue('version') if WHLVERSION is None: WHLVERSION = VERSION diff --git a/makepanda/makepandacore.py b/makepanda/makepandacore.py index 6705c72a1f..3936920ef9 100644 --- a/makepanda/makepandacore.py +++ b/makepanda/makepandacore.py @@ -12,9 +12,11 @@ from distutils import sysconfig if sys.version_info >= (3, 0): import pickle import _thread as thread + import configparser else: import cPickle as pickle import thread + import ConfigParser as configparser SUFFIX_INC = [".cxx",".cpp",".c",".h",".I",".yxx",".lxx",".mm",".rc",".r"] SUFFIX_DLL = [".dll",".dlo",".dle",".dli",".dlm",".mll",".exe",".pyd",".ocx"] @@ -2849,6 +2851,21 @@ def CopyPythonTree(dstdir, srcdir, lib2to3_fixers=[], threads=0): ## ######################################################################## +cfg_parser = None + +def GetMetadataValue(key): + global cfg_parser + if not cfg_parser: + # Parse the metadata from the setup.cfg file. + cfg_parser = configparser.ConfigParser() + cfg_parser.read('setup.cfg') + + value = cfg_parser.get('metadata', key) + if key == 'classifiers': + value = value.strip().split('\n') + return value + +# This function is being phased out. def ParsePandaVersion(fn): try: f = open(fn, "r") diff --git a/makepanda/makewheel.py b/makepanda/makewheel.py index 71ec67a269..ab3375e708 100644 --- a/makepanda/makewheel.py +++ b/makepanda/makewheel.py @@ -20,7 +20,7 @@ import tempfile import subprocess from distutils.sysconfig import get_config_var from optparse import OptionParser -from makepandacore import ColorText, LocateBinary, ParsePandaVersion, GetExtensionSuffix, SetVerbose, GetVerbose +from makepandacore import ColorText, LocateBinary, ParsePandaVersion, GetExtensionSuffix, SetVerbose, GetVerbose, GetMetadataValue from base64 import urlsafe_b64encode @@ -103,16 +103,15 @@ Tag: {0}-{1}-{2} """ METADATA = { - "license": "BSD", - "name": "Panda3D", + "license": GetMetadataValue('license'), + "name": GetMetadataValue('name'), "metadata_version": "2.0", "generator": "makepanda", - "summary": "Panda3D is a game engine, a framework for 3D rendering and " - "game development for Python and C++ programs.", + "summary": GetMetadataValue('description'), "extensions": { "python.details": { "project_urls": { - "Home": "https://www.panda3d.org/" + "Home": GetMetadataValue('url'), }, "document_names": { "license": "LICENSE.txt" @@ -120,25 +119,13 @@ METADATA = { "contacts": [ { "role": "author", - "email": "etc-panda3d@lists.andrew.cmu.edu", - "name": "Panda3D Team" + "name": GetMetadataValue('author'), + "email": GetMetadataValue('author_email'), } ] } }, - "classifiers": [ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "Intended Audience :: End Users/Desktop", - "License :: OSI Approved :: BSD License", - "Operating System :: OS Independent", - "Programming Language :: C++", - "Programming Language :: Python", - "Topic :: Games/Entertainment", - "Topic :: Multimedia", - "Topic :: Multimedia :: Graphics", - "Topic :: Multimedia :: Graphics :: 3D Rendering" - ] + "classifiers": GetMetadataValue('classifiers'), } PANDA3D_TOOLS_INIT = """import os, sys diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000000..a2b7a81fa5 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,24 @@ +[metadata] +name = Panda3D +version = 1.10.0 +url = https://www.panda3d.org/ +description = Panda3D is a framework for 3D rendering and game development for Python and C++ programs. +license = Modified BSD License +license_file = LICENSE +classifiers = + Development Status :: 5 - Production/Stable + Intended Audience :: Developers + Intended Audience :: End Users/Desktop + License :: OSI Approved :: BSD License + Operating System :: OS Independent + Programming Language :: C++ + Programming Language :: Python + Topic :: Games/Entertainment + Topic :: Multimedia + Topic :: Multimedia :: Graphics + Topic :: Multimedia :: Graphics :: 3D Rendering +author = Panda3D Team +author_email = etc-panda3d@lists.andrew.cmu.edu + +[tool:pytest] +testpaths = tests