File: build_binaries_windows.py

package info (click to toggle)
pydevd 3.3.0%2Bds-4
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 13,892 kB
  • sloc: python: 77,508; cpp: 1,869; sh: 368; makefile: 50; ansic: 4
file content (91 lines) | stat: -rw-r--r-- 2,663 bytes parent folder | download
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
r"""
Creating the needed environments for creating the pre-compiled distribution on Windows:

See:

build_tools\pydevd_release_process.txt

for building binaries/release process.
"""

from __future__ import unicode_literals
import os
import subprocess
import sys

miniconda_envs = os.getenv("MINICONDA_ENVS", r"D:\bin\miniconda\envs")

python_installations = [
    r"%s\py38_64\python.exe" % miniconda_envs,
    r"%s\py39_64\python.exe" % miniconda_envs,
    r"%s\py310_64\python.exe" % miniconda_envs,
    r"%s\py311_64\python.exe" % miniconda_envs,
    r"%s\py312_64\python.exe" % miniconda_envs,
    # See: build_tools\pydevd_release_process.txt when adding a new one
]

root_dir = os.path.dirname(os.path.dirname(__file__))


def list_binaries():
    for f in os.listdir(os.path.join(root_dir, "_pydevd_bundle")):
        if f.endswith(".pyd"):
            yield f


def extract_version(python_install):
    return python_install.split("\\")[-2][2:]


def main():
    from generate_code import generate_dont_trace_files
    from generate_code import generate_cython_module

    # First, make sure that our code is up to date.
    generate_dont_trace_files()
    generate_cython_module()

    for python_install in python_installations:
        assert os.path.exists(python_install), "%s does not exist." % (python_install,)

    from build import remove_binaries

    remove_binaries([".pyd"])

    for f in list_binaries():
        raise AssertionError("Binary not removed: %s" % (f,))

    for i, python_install in enumerate(python_installations):
        print()
        print("*" * 80)
        print("*" * 80)
        print()
        new_name = "pydevd_cython_%s_%s" % (sys.platform, extract_version(python_install))
        args = [
            python_install,
            os.path.join(root_dir, "build_tools", "build.py"),
            "--no-remove-binaries",
            "--target-pyd-name=%s" % new_name,
            "--force-cython",
        ]
        if i != 0:
            args.append("--no-regenerate-files")
        name_frame_eval = "pydevd_frame_evaluator_%s_%s" % (sys.platform, extract_version(python_install))
        args.append("--target-pyd-frame-eval=%s" % name_frame_eval)
        print("Calling: %s" % (" ".join(args)))

        env = os.environ.copy()
        python_exe_dir = os.path.dirname(python_install)
        env["PATH"] = env["PATH"] + ";" + os.path.join(python_exe_dir, "DLLs") + ";" + os.path.join(python_exe_dir, "Library", "bin")
        subprocess.check_call(args, env=env)


if __name__ == "__main__":
    main()

# To run do:
# See:
#
# build_tools\pydevd_release_process.txt
#
# for building binaries/release process.