-
Notifications
You must be signed in to change notification settings - Fork 3
/
_msbuild.py
63 lines (59 loc) · 2.16 KB
/
_msbuild.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import os
from pymsbuild import *
METADATA = {
"Metadata-Version": "2.1",
"Name": "pymsbuild",
"Version": "0.0.1",
"Author": "Steve Dower",
"Author-email": "[email protected]",
"Home-page": "https://github.com/zooba/pymsbuild",
"Project-url": [
"Bug Tracker, https://github.com/zooba/pymsbuild/issues",
],
"Summary": "The pymsbuild build backend.",
"Description": File("README.md"),
"Description-Content-Type": "text/markdown",
"Keywords": "build,pep-517,msbuild,packaging,cython",
"Classifier": [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Software Development :: Build Tools",
"Topic :: Software Development :: Compilers",
"Topic :: Utilities",
],
"Requires-External": "msbuild,dotnet",
"Requires-Dist": [
"packaging",
],
"WheelTag": "py3-none-any",
}
PACKAGE = Package(
"pymsbuild",
PyFile("pymsbuild/*.py").excluding("pymsbuild/__init__.py"),
PyFile("pymsbuild/__init__.py", IncludeInWheel=False),
PyFile("pymsbuild/__init__.py.ver", name="__init__.py"),
File("pymsbuild/*.in"),
File("pymsbuild/targets/*", name="targets/*"),
)
def init_METADATA():
version = os.getenv("BUILD_BUILDNUMBER")
ghref = os.getenv("GITHUB_REF")
if ghref:
version = ghref.rpartition("/")[2]
if version:
METADATA["Version"] = version
def init_PACKAGE(tag=None):
if not os.path.exists("pymsbuild/__init__.py.ver"):
with open("pymsbuild/__init__.py", "r", encoding="utf-8") as f:
content = f.read()
content = content.replace("%VERSION%", METADATA["Version"])
with open("pymsbuild/__init__.py.ver", "w", encoding="utf-8") as f:
f.write(content)