mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
d1b598a32b
* Merge isinstance calls * Inline variable that is immediately returned * Replace set() with comprehension * Replace assignment with augmented assignment * Remove unnecessary else after guard condition * Convert for loop into list comprehension * Replace unused for index with underscore * Merge nested if conditions * Convert for loop into list comprehension * Convert for loop into set comprehension * Remove unnecessary else after guard condition * Replace if statements with if expressions * Simplify sequence comparison * Replace multiple comparisons with in operator * Merge isinstance calls * Merge nested if conditions * Add guard clause * Merge duplicate blocks in conditional * Replace unneeded comprehension with generator * Inline variable that is immediately returned * Remove unused imports * Replace unneeded comprehension with generator * Remove unused imports * Remove unused import * Inline variable that is immediately returned * Swap if/else branches and remove unnecessary else * Use str.join() instead of for loop * Multiple refactors - Remove redundant pass statement - Hoist repeated code outside conditional statement - Swap if/else to remove empty if body * Inline variable that is immediately returned * Simplify generator expression * Replace if statement with if expression * Multiple refactoring - Replace range(0, x) with range(x) - Swap if/else branches - Remove unnecessary else after guard condition * Use str.join() instead of for loop * Hoist repeated code outside conditional statement * Use str.join() instead of for loop * Inline variables that are immediately returned * Merge dictionary assignment with declaration * Use items() to directly unpack dictionary values * Extract dup code from methods into a new one
58 lines
1.6 KiB
Python
58 lines
1.6 KiB
Python
import setuptools
|
|
import importlib
|
|
import os
|
|
import sys
|
|
|
|
packagename = 'maloja'
|
|
|
|
assert os.path.exists(packagename)
|
|
|
|
# use local package!
|
|
sys.path.insert(0,".")
|
|
|
|
pkginfo = importlib.import_module(".__pkginfo__",package=packagename)
|
|
pkginfo = pkginfo.__dict__
|
|
|
|
|
|
# extract info
|
|
|
|
readmelocs = [
|
|
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(
|
|
name=pkginfo.get("links",{}).get("pypi") or pkginfo["name"],
|
|
version=".".join(str(n) for n in pkginfo["version"]),
|
|
author=pkginfo["author"]["name"],
|
|
author_email=pkginfo["author"]["email"],
|
|
description=pkginfo["desc"],
|
|
license=pkginfo.get("license") or "GPLv3",
|
|
long_description=long_description,
|
|
long_description_content_type="text/markdown",
|
|
url="https://github.com/" + pkginfo["author"]["github"] + "/" + (pkginfo.get("links",{}).get("github") or pkginfo.get("name")),
|
|
packages=[packagename],
|
|
classifiers=[
|
|
"Programming Language :: Python :: 3",
|
|
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
|
|
"Operating System :: OS Independent",
|
|
],
|
|
python_requires=pkginfo.get("python_version"),
|
|
install_requires=pkginfo.get("requires",[]),
|
|
package_data={'': pkginfo.get("resources",[])},
|
|
include_package_data=True,
|
|
entry_points = {
|
|
"console_scripts":[
|
|
cmd + " = " + pkginfo["name"] + "." + pkginfo["commands"][cmd]
|
|
for cmd in pkginfo.get("commands",[])
|
|
],
|
|
**{k:pkginfo["entrypoints"][k] for k in pkginfo.get("entrypoints",{})}
|
|
}
|
|
)
|