Overview
Comment: | depends version cleanup, fixate filename= instead of fn=, drop nested Util results |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
1cd99def487e1c6b214bf4bc8e5d1408 |
User & Date: | mario on 2022-10-28 07:09:42 |
Other Links: | manifest | tags |
Context
2022-10-28
| ||
07:11 | update commentary, force dynamic= fields, skip field if set via ini, adapt to .setup changes check-in: ff3080056a user: mario tags: trunk | |
07:09 | depends version cleanup, fixate filename= instead of fn=, drop nested Util results check-in: 1cd99def48 user: mario tags: trunk | |
07:08 | fix residual theme= in kwargs check-in: 0ea503177a user: mario tags: trunk | |
Changes
Modified pluginconf/setup.py from [9534c97f04] to [87ccea3a82].
1 2 3 4 5 | # encoding: utf-8 # api: setuptools ##type: functions # title: setup() wrapper # description: utilizes PMD to populate some package fields | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | # encoding: utf-8 # api: setuptools ##type: functions # title: setup() wrapper # description: utilizes PMD to populate some package fields # version: 0.5 # license: PD # pylint: disable=line-too-long # # Utilizes plugin meta data to cut down setup.py incantations # to basically just: # # from pluginconf.setup import setup |
︙ | ︙ | |||
46 47 48 49 50 51 52 | """ Simulates setuptools.setup() """ import os import re import glob import pprint | < | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | """ Simulates setuptools.setup() """ import os import re import glob import pprint import pluginconf def name_to_fn(name): """ find primary entry point.py from package name """ for pfx in "", "src/", "src/"+name+"/": for sfx in ".py", "/__init__.py": |
︙ | ︙ | |||
91 92 93 94 95 96 97 | "long_description_content_type": self.doc_format or "text/plain" } def python_requires(self): """ depends: python >= 3.5 """ deps = re.findall(r"python\s*\(?(>=?\s?[\d.]+)", self.get("depends", "")) if deps: | | | | > > > > > > > | | | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | "long_description_content_type": self.doc_format or "text/plain" } def python_requires(self): """ depends: python >= 3.5 """ deps = re.findall(r"python\s*\(?(>=?\s?[\d.]+)", self.get("depends", "")) if deps: return deps[0] return None def install_requires(self): """ depends: python:module, pip:module """ deps = re.findall(r"(?:python|pip):([\w\-]+)\s*([<!=>\s\d\w.\-~]+|\([<!=>\s\d\w.\-,~]+\))?", self.get("depends", "")) if deps: for index, (name, ver) in enumerate(deps): ver = re.sub(r"[(\s)]+", "", ver) if not ver: continue ver = re.sub("(,)", r"\1 ", ver) deps[index] = (name, " (" + ver + ")") # doesn't need much cleanup: https://peps.python.org/pep-0508/ return [name + ver for name, ver in deps] return [] def extras_require(self): """ suggest: line """ deps = re.findall(r"(?:python|pip):([\w\-]+)\s*\(?\s*([>=<]+\s*[\d.\-]+)", self.get("suggests", "")) if deps: return dict(deps) return {} |
︙ | ︙ | |||
186 187 188 189 190 191 192 | return params def get_keywords(self): """ keywords= """ return self.keywords or self.category or self.type | | | | | | > > > > > > | 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | return params def get_keywords(self): """ keywords= """ return self.keywords or self.category or self.type @pluginconf.renamed_arguments({"fn": "filename"}) def setup(filename=None, debug=False, **kwargs): """ Wrapper around `setuptools.setup()` which adds some defaults and plugin meta data import, with some shortcut parameters: Parameters ---------- filename : str main file "pkg/main.py" (else deduced from primary package name) debug : bool display collected options prior setuptools.setup() invocation long_description : str e.g. "README.md", else comment block used Other setup() params work as usual, and are passed trough. Notably entry_points= or data_files= can be used, even if they get augmented. """ # optionalized here (avoid dependency in flit import) # p-y-l-i-n-t: disable=import-outside-toplevel import setuptools # stub values stub = { "classifiers": [], "project_urls": {}, "python_requires": ">= 2.7", "install_requires": [], |
︙ | ︙ | |||
228 229 230 231 232 233 234 | if "name" not in kwargs and kwargs.get("packages"): kwargs["name"] = kwargs["packages"][0] # read README if field empty or says `@README` if re.match("^$|^[@./]*README.{0,5}$", kwargs.get("long_description", "")): kwargs.update(get_readme()) | | < < < | | | | | < < < | | | 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | if "name" not in kwargs and kwargs.get("packages"): kwargs["name"] = kwargs["packages"][0] # read README if field empty or says `@README` if re.match("^$|^[@./]*README.{0,5}$", kwargs.get("long_description", "")): kwargs.update(get_readme()) # search name= package if no filename= given if not filename and kwargs.get("name"): filename = name_to_fn(kwargs["name"]) # read plugin meta data (PMD) pmd = MetaUtils( pluginconf.plugin_meta(filename=filename) ) # use id: if no name= still if pmd.get("id") and not kwargs.get("name"): if pmd["id"] == "__init__": pmd["id"] = re.findall(r"([\w\.\-]+)/__init__.+$", filename)[0] kwargs["name"] = pmd["id"] # version:, description:, author: for field in "version", "description", "license", "author", "url": if field in pmd and not field in kwargs: kwargs[field] = pmd[field] # other urls: kwargs["project_urls"].update(pmd.project_urls()) # depends: if "depends" in pmd: kwargs["python_requires"] = pmd.python_requires() if "depends" in pmd and not kwargs["install_requires"]: kwargs["install_requires"] = pmd.install_requires() # suggests: if "suggests" in pmd and not kwargs["extras_require"]: kwargs["extras_require"].update(pmd.extras_require()) # doc: if not kwargs.get("long_description"): kwargs.update(pmd.plugin_doc()) |
︙ | ︙ |
Modified setup.py from [44fd264fd9] to [d3a7a950ad].
︙ | ︙ | |||
13 14 15 16 17 18 19 | import pluginconf.setup #from os import system #system("pandoc -f markdown -t rst README.md > README.rst") pluginconf.setup.setup( | | > | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | import pluginconf.setup #from os import system #system("pandoc -f markdown -t rst README.md > README.rst") pluginconf.setup.setup( filename="pluginconf/__init__.py", long_description="README.md", packages=["pluginconf"], #author_email="m..@include-once.org", # entry_points={ # "console_scripts": [ # "flit-pluginconf=pluginconf.flit:main", # ] # }, ) |