Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
cefpython/src/mac/compile.py at cefpython54 · andrewleech/cefpython · GitHub
Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
View all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
andrewleech
/
cefpython
Public
forked from
cztomczak/cefpython
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Files
Expand file tree
cefpython54
Breadcrumbs
cefpython
/
src
/
mac
/
compile.py
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
181 lines (146 loc) · 5.36 KB
cefpython54
Breadcrumbs
cefpython
/
src
/
mac
/
compile.py
Copy path
Top
File metadata and controls
Code
Blame
181 lines (146 loc) · 5.36 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
import
sys
import
os
import
glob
import
shutil
import
subprocess
import
platform
import
stat
import
re
# This will not show "Segmentation fault" error message:
# | subprocess.call(["python", "./wxpython.py"])
# You need to call it with shell=True for this kind of
# error message to be shown:
# | subprocess.call("python wxpython.py", shell=True)
# How to debug:
# 1. Install "python-dbg" package
# 2. Install "python-wxgtk2.8-dbg" package
# 3. Run "python compile.py debug"
# 4. In cygdb type "cy run"
# 5. To display debug backtrace type "cy bt"
# 6. More commands: http://docs.cython.org/src/userguide/debugging.html
if
len
(
sys
.
argv
)
>
1
and
"--debug"
in
sys
.
argv
:
DEBUG
=
True
print
(
"DEBUG mode On"
)
else
:
DEBUG
=
False
if
len
(
sys
.
argv
)
>
1
and
re
.
search
(
r"^\d+\.\d+$"
,
sys
.
argv
[
1
]):
VERSION
=
sys
.
argv
[
1
]
else
:
print
(
"[compile.py] ERROR: expected first argument to be version number"
)
print
(
" Allowed version format:
\\
d+\.
\\
d+"
)
sys
.
exit
(
1
)
print
(
"VERSION=%s"
%
VERSION
)
BITS
=
platform
.
architecture
()[
0
]
assert
(
BITS
==
"32bit"
or
BITS
==
"64bit"
)
PYTHON_CMD
=
"python"
if
sys
.
maxint
==
2147483647
:
BITS
=
"32bit"
PYTHON_CMD
=
"arch -i386 python"
if
BITS
==
"32bit"
:
if
"i386"
not
in
os
.
getenv
(
"ARCHFLAGS"
,
""
):
raise
Exception
(
"Detected Python 32bit, but ARCHFLAGS is not i386"
)
if
"i386"
not
in
os
.
getenv
(
"CEF_CCFLAGS"
,
""
):
raise
Exception
(
"Detected Python 32bit, but CEF_CCFLAGS is not i386"
)
elif
BITS
==
"64bit"
:
if
"x86_64"
not
in
os
.
getenv
(
"ARCHFLAGS"
,
""
):
raise
Exception
(
"Detected Python 64bit, but ARCHFLAGS is not x86_64"
)
if
"x86_64"
not
in
os
.
getenv
(
"CEF_CCFLAGS"
,
""
):
raise
Exception
(
"Detected Python 64bit, but CEF_CCFLAGS is not x86_64"
)
PYVERSION
=
str
(
sys
.
version_info
[
0
])
+
str
(
sys
.
version_info
[
1
])
print
(
"PYVERSION = %s"
%
PYVERSION
)
print
(
"BITS = %s"
%
BITS
)
os
.
environ
[
"CC"
]
=
"gcc"
os
.
environ
[
"CXX"
]
=
"g++"
print
(
"Compiling C++ projects"
)
# Need to allow continuing even when make fails, as it may
# fail because the "public" function declaration is not yet
# in "cefpython.h", but for it to be generated we need to run
# cython compiling, so in this case you continue even when make
# fails and then run the compile.py script again and this time
# make should succeed.
os
.
chdir
(
"./../cpp_utils/"
)
subprocess
.
call
(
"rm -f *.o *.a"
,
shell
=
True
)
ret
=
subprocess
.
call
(
"make -f Makefile"
,
shell
=
True
)
if
ret
!=
0
:
what
=
raw_input
(
"make failed, press 'y' to continue, 'n' to stop: "
)
if
what
!=
"y"
:
sys
.
exit
(
1
)
os
.
chdir
(
"./../client_handler/"
)
subprocess
.
call
(
"rm -f *.o *.a"
,
shell
=
True
)
ret
=
subprocess
.
call
(
"make -f Makefile"
,
shell
=
True
)
if
ret
!=
0
:
what
=
raw_input
(
"make failed, press 'y' to continue, 'n' to stop: "
)
if
what
!=
"y"
:
sys
.
exit
(
1
)
os
.
chdir
(
"./../subprocess/"
)
subprocess
.
call
(
"rm -f *.o *.a"
,
shell
=
True
)
subprocess
.
call
(
"rm -f subprocess"
,
shell
=
True
)
ret
=
subprocess
.
call
(
"make -f Makefile-libcefpythonapp"
,
shell
=
True
)
if
ret
!=
0
:
what
=
raw_input
(
"make failed, press 'y' to continue, 'n' to stop: "
)
if
what
!=
"y"
:
sys
.
exit
(
1
)
ret
=
subprocess
.
call
(
"make -f Makefile"
,
shell
=
True
)
if
ret
!=
0
:
what
=
raw_input
(
"make failed, press 'y' to continue, 'n' to stop: "
)
if
what
!=
"y"
:
sys
.
exit
(
1
)
subprocess_exe
=
"./../mac/binaries_%s/subprocess"
%
(
BITS
)
if
os
.
path
.
exists
(
"./subprocess"
):
# .copy() will also copy Permission bits
shutil
.
copy
(
"./subprocess"
,
subprocess_exe
)
# os.chdir("./../v8function_handler/")
# ret = subprocess.call("make -f Makefile", shell=True)
# if ret != 0:
# what = raw_input("make failed, press 'y' to continue, 'n' to stop: ")
# if what != "y":
# sys.exit(1)
os
.
chdir
(
"./../mac/"
)
try
:
os
.
remove
(
"./binaries_%s/cefpython_py%s.so"
%
(
BITS
,
PYVERSION
))
except
OSError
:
pass
os
.
system
(
"rm ./setup/cefpython_py*.so"
)
pyx_files
=
glob
.
glob
(
"./setup/*.pyx"
)
for
f
in
pyx_files
:
os
.
remove
(
f
)
try
:
shutil
.
rmtree
(
"./setup/build"
)
except
OSError
:
pass
os
.
chdir
(
"./setup"
)
ret
=
subprocess
.
call
(
PYTHON_CMD
+
" fix_pyx_files.py"
,
shell
=
True
)
if
ret
!=
0
:
sys
.
exit
(
"ERROR"
)
# Create __version__.pyx after fix_pyx_files.py was called,
# as that script deletes old pyx files before copying new ones.
print
(
"Creating __version__.pyx file"
)
with
open
(
"__version__.pyx"
,
"w"
)
as
fo
:
fo
.
write
(
'__version__ = "{}"
\n
'
.
format
(
VERSION
))
if
DEBUG
:
ret
=
subprocess
.
call
(
PYTHON_CMD
+
"-dbg setup.py build_ext --inplace"
" --cython-gdb"
,
shell
=
True
)
else
:
ret
=
subprocess
.
call
(
PYTHON_CMD
+
" setup.py build_ext --inplace"
,
shell
=
True
)
if
DEBUG
:
shutil
.
rmtree
(
"./../binaries_%s/cython_debug/"
%
BITS
,
ignore_errors
=
True
)
shutil
.
copytree
(
"./cython_debug/"
,
"./../binaries_%s/cython_debug/"
%
BITS
)
os
.
chdir
(
"../"
)
oldpyxfiles
=
glob
.
glob
(
"./setup/*.pyx"
)
print
(
"Removing old pyx files in /setup/: %s"
%
oldpyxfiles
)
for
pyxfile
in
oldpyxfiles
:
if
os
.
path
.
exists
(
pyxfile
):
os
.
remove
(
pyxfile
)
if
ret
!=
0
:
sys
.
exit
(
"ERROR"
)
exitcode
=
os
.
system
(
"mv ./setup/cefpython_py{0}*.so"
" ./binaries_{1}/cefpython_py{0}.so"
.
format
(
PYVERSION
,
BITS
))
if
exitcode
:
raise
RuntimeError
(
"Failed to move the cefpython module"
)
print
(
"DONE"
)
os
.
chdir
(
"./binaries_%s"
%
BITS
)
if
DEBUG
:
subprocess
.
call
(
"cygdb . --args python-dbg wxpython.py"
,
shell
=
True
)
else
:
subprocess
.
call
(
PYTHON_CMD
+
" wxpython.py"
,
shell
=
True
)
You can’t perform that action at this time.