mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Created thin setup.py for compatibility
This commit is contained in:
parent
c98fc592a1
commit
c745d4a647
58
setup.py
58
setup.py
@ -1,57 +1,39 @@
|
|||||||
import setuptools
|
import setuptools
|
||||||
import importlib
|
import toml
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
|
|
||||||
packagename = 'maloja'
|
|
||||||
|
|
||||||
assert os.path.exists(packagename)
|
with open("pyproject.toml") as fd:
|
||||||
|
pkgdata = toml.load(fd)
|
||||||
# use local package!
|
projectdata = pkgdata['project']
|
||||||
sys.path.insert(0,".")
|
|
||||||
|
|
||||||
pkginfo = importlib.import_module(".__pkginfo__",package=packagename)
|
|
||||||
pkginfo = pkginfo.__dict__
|
|
||||||
|
|
||||||
|
|
||||||
# extract info
|
# extract info
|
||||||
|
with open(projectdata['readme'], "r") as fh:
|
||||||
readmelocs = [
|
long_description = fh.read()
|
||||||
packagename + "/README.md",
|
|
||||||
"README.md"
|
|
||||||
]
|
|
||||||
|
|
||||||
for rml in readmelocs:
|
|
||||||
if os.path.exists(rml):
|
|
||||||
with open(rml, "r") as fh:
|
|
||||||
long_description = fh.read()
|
|
||||||
break
|
|
||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name=pkginfo.get("links",{}).get("pypi") or pkginfo["name"],
|
name=projectdata['name'],
|
||||||
version=".".join(str(n) for n in pkginfo["version"]),
|
version=projectdata['version'],
|
||||||
author=pkginfo["author"]["name"],
|
author=projectdata['authors'][0]['name'],
|
||||||
author_email=pkginfo["author"]["email"],
|
author_email=projectdata['authors'][0]['email'],
|
||||||
description=pkginfo["desc"],
|
description=projectdata["description"],
|
||||||
license=pkginfo.get("license") or "GPLv3",
|
license="GPLv3",
|
||||||
long_description=long_description,
|
long_description=long_description,
|
||||||
long_description_content_type="text/markdown",
|
long_description_content_type="text/markdown",
|
||||||
url="https://github.com/" + pkginfo["author"]["github"] + "/" + (pkginfo.get("links",{}).get("github") or pkginfo.get("name")),
|
url=projectdata['urls']['repository'],
|
||||||
packages=[packagename],
|
packages=[projectdata['name']],
|
||||||
classifiers=[
|
classifiers=[
|
||||||
"Programming Language :: Python :: 3",
|
"Programming Language :: Python :: 3",
|
||||||
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
|
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
|
||||||
"Operating System :: OS Independent",
|
"Operating System :: OS Independent",
|
||||||
],
|
],
|
||||||
python_requires=pkginfo.get("python_version"),
|
python_requires=projectdata['requires-python'],
|
||||||
install_requires=pkginfo.get("requires",[]),
|
install_requires=projectdata['dependencies'],
|
||||||
package_data={'': pkginfo.get("resources",[])},
|
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
entry_points = {
|
entry_points = {
|
||||||
"console_scripts":[
|
'console_scripts':[
|
||||||
cmd + " = " + pkginfo["name"] + "." + pkginfo["commands"][cmd]
|
k + '=' + projectdata['scripts'][k] for k in projectdata['scripts']
|
||||||
for cmd in pkginfo.get("commands",[])
|
]
|
||||||
],
|
|
||||||
**{k:pkginfo["entrypoints"][k] for k in pkginfo.get("entrypoints",{})}
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user