forked from microsoft/python-etwtrace
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_msbuild_test.py
More file actions
67 lines (60 loc) · 2 KB
/
_msbuild_test.py
File metadata and controls
67 lines (60 loc) · 2 KB
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
64
65
66
67
import os
from pymsbuild import *
from pymsbuild.cython import *
# See https://packaging.python.org/en/latest/specifications/core-metadata/ for fields
METADATA = {
"Metadata-Version": "2.1",
"Name": "etwtrace-test",
"Version": os.getenv("BUILD_BUILDNUMBER", "0.1"),
"Author": "Microsoft Corporation",
"Author-email": "python@microsoft.com",
"Home-page": "https://github.com/microsoft/python-etwtrace/",
"Project-url": [
"Bug Tracker, https://github.com/microsoft/python-etwtrace/issues",
],
"Summary": "Test files",
"Classifier": ["Private :: Do Not Upload"],
}
PYD_OPTS = [
Property("SpectreMitigation", "Spectre"),
ItemDefinition(
"ClCompile",
PreprocessorDefinitions=Prepend("CYTHON_FAST_THREAD_STATE=0;"),
ControlFlowGuard="Guard",
SDLCheck="true",
WarningLevel="Level3",
OmitFramePointers="false",
),
ItemDefinition(
"Link",
AdditionalDependencies=Prepend("ntdll.lib;tdh.lib;"),
CETCompat=ConditionalValue("true", condition="$(Platform) == 'Win32' or $(Platform) == 'x64'"),
),
]
PACKAGE = Package(
'etwtrace',
Package('test',
CythonPydFile(
'_decoder',
*PYD_OPTS,
ItemDefinition("ClCompile", DisableSpecificWarnings=Prepend("4267;4244;4018;")),
PyxFile('etwtrace/_decoder.pyx'),
IncludeFile('etwtrace/_windows.pxd'),
CSourceFile('etwtrace/_tdhreader.cpp'),
IncludeFile('etwtrace/_tdhreader.h'),
),
PydFile(
'DiagnosticsHub.InstrumentationCollector',
*PYD_OPTS,
CSourceFile('etwtrace/_diaghubstub.c'),
TargetExt='.dll',
),
),
source='src',
)
def init_METADATA():
import os, re
_, sep, version = os.getenv("GITHUB_REF", os.getenv("BUILD_SOURCEBRANCH", "")).rpartition("/")
if sep and re.match(r"\d+(\.\d+)+((a|b|rc)\d+)?$", version):
# Looks like a version tag
METADATA["Version"] = version