Skip to content

Commit

Permalink
Fixes #98 - Updated pymsbuild init template for metadata 2.2 (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
zooba authored Dec 16, 2024
1 parent 356aa37 commit 80932f0
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 6 deletions.
7 changes: 4 additions & 3 deletions _msbuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
from pymsbuild import *

METADATA = {
"Metadata-Version": "2.1",
"Metadata-Version": "2.2",
"Name": "pymsbuild",
"Version": "0.0.1",
"Author": "Steve Dower",
"Author-email": "steve.dower@python.org",
"Home-page": "https://github.com/zooba/pymsbuild",
"Project-url": [
"Bug Tracker, https://github.com/zooba/pymsbuild/issues",
"Homepage, https://github.com/zooba/pymsbuild",
"Source, https://github.com/zooba/pymsbuild",
"Issues, https://github.com/zooba/pymsbuild/issues",
],
"Summary": "The pymsbuild build backend.",
"Description": File("README.md"),
Expand Down
16 changes: 16 additions & 0 deletions pymsbuild/_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,22 @@ def run(build_state, config_name="_msbuild.py"):

substitutions["BUILD_REQUIRES"] = repr(build_requires)

substitutions["GIT"] = "TODO"
substitutions["GITISSUES"] = "TODO"

cfg = root / ".git/config"
if cfg.is_file():
with cfg.open("r", encoding="utf-8-sig") as f:
for line in f:
if line.strip().startswith("[remote"):
for line in f:
m = re.match(r"\s*url\s*=\s*(.+)$", line)
if m:
substitutions["GIT"] = m.group(1)
substitutions["GITISSUES"] = f"{m.group(1)}/issues"
break
break

code = re.sub(r"\<(\w+)\>", lambda m: substitutions.get(m.group(1)), TEMPLATE)
with open(config_file, "w", encoding="utf-8") as f:
print(code, file=f, end="")
Expand Down
19 changes: 16 additions & 3 deletions pymsbuild/_msbuild.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,20 @@ from pymsbuild import *

# See https://packaging.python.org/en/latest/specifications/core-metadata/ for fields
METADATA = {
"Metadata-Version": "2.1",
"Metadata-Version": "2.2",
"Name": "<NAME>",
"Version": "1.0",
"Author": "TODO",
"Author-email": "TODO",
"Home-page": "TODO",
"Project-url": [
"Bug Tracker, TODO",
"Homepage, <GIT>",
"Source, <GIT>",
"Issues, <GITISSUES>",
#"Download, TODO",
#"Changelog, TODO",
#"Release Notes, TODO",
#"Documentation, TODO",
#"Funding, TODO",
],
"Summary": "TODO",
"Description": File("README.md"),
Expand All @@ -23,6 +29,13 @@ METADATA = {
# https://packaging.python.org/en/latest/specifications/dependency-specifiers/
],

# Source incompatible with old language versions? Set a minimum here
#"Requires-Python": ">=3.10",

# Doing any metadata tricks in init_PACKAGE()? Specify changeable keys here
# (Changing in init_METADATA doesn't require anything here)
#Dynamic: [],

# Universal wheel? Uncomment this to target all Python 3 installs.
#"WheelTag": "py3-none-any",

Expand Down

0 comments on commit 80932f0

Please sign in to comment.