Skip to content
Snippets Groups Projects
Commit 4df4a409 authored by Tessaris Sergio's avatar Tessaris Sergio
Browse files

build: declarative package definition

parent e2cb799b
No related branches found
No related tags found
No related merge requests found
[metadata]
name = wumpus
version = attr:wumpus.__version__
description = My package description
long_description = file: README.md
license = MIT
author = Sergio Tessaris
author_email = tessaris@inf.unibz.it
[options]
zip_safe = False
include_package_data = True
packages = find:
python_requires = >=3.7
[options.entry_points]
console_scripts =
gridrunner = wumpus.cli:main
[options.extras_require]
gym = gym
from setuptools import setup, find_packages
import re
import codecs
import os
import subprocess
#!/usr/bin/env python
import setuptools
# Hack to allow non-normalised versions
# see <https://github.com/pypa/setuptools/issues/308>
from setuptools.extern.packaging import version
version.Version = version.LegacyVersion
_INCLUDE_GIT_REV_ = False
# see <https://stackoverflow.com/a/39671214> and
# <https://packaging.python.org/guides/single-sourcing-package-version>
def find_version(*pkg_path):
pkg_dir = os.path.join(os.path.abspath(os.path.dirname(__file__)), *pkg_path)
version_file = codecs.open(os.path.join(pkg_dir, '__init__.py'), 'r').read()
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
version_file, re.M)
_git_revision_ = None
if _INCLUDE_GIT_REV_:
try:
_git_revision_ = subprocess.check_output(['git', 'describe', '--always', '--dirty'], encoding='utf-8').strip()
except subprocess.CalledProcessError:
pass
if version_match:
return version_match.group(1) + ('' if _git_revision_ is None else '+' + _git_revision_)
elif _git_revision_:
return _git_revision_
raise RuntimeError("Unable to find version string.")
def long_description_md(fname='README.md'):
this_directory = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(this_directory, fname), encoding='utf-8') as f:
long_description = f.read()
return long_description
setup(
name='wumpus',
version=find_version('wumpus'),
description='Wumpus world simulator',
long_description=long_description_md(),
long_description_content_type='text/markdown',
author='Sergio Tessaris',
author_email='tessaris@inf.unibz.it',
packages=find_packages(),
include_package_data=True,
entry_points= {
'console_scripts': ['gridrunner=wumpus.cli:main']
},
install_requires=[
],
extras_require={
'gym': ['gym']
},
exclude_package_data={'': ['.gitignore']},
)
if __name__ == "__main__":
setuptools.setup()
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment