Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
cefpython/tools/installer/cefpython3.setup.py at cefpython55 · PythonNexus/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 }}
Uh oh!
There was an error while loading.
Please reload this page
.
PythonNexus
/
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
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Files
Expand file tree
cefpython55
Breadcrumbs
cefpython
/
tools
/
installer
/
cefpython3.setup.py
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
245 lines (206 loc) · 8.39 KB
cefpython55
Breadcrumbs
cefpython
/
tools
/
installer
/
cefpython3.setup.py
Copy path
Top
File metadata and controls
Code
Blame
245 lines (206 loc) · 8.39 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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
# Copyright (c) 2017 The CEF Python authors. All rights reserved.
# Licensed under BSD 3-clause license.
"""
cefpython3 package setup.py file.
Usage:
setup.py install
setup.py bdist_wheel [--universal]
Options:
install Install package
bdist_wheel Generate wheel package. Use the --universal flag when
you have built cefpython modules for multiple Python
versions.
"""
# NOTE: Template variables like {{VERSION}} are replaced with actual
# values when make_installer.py tool generates this package
# installer.
import
copy
import
os
import
platform
import
subprocess
import
sys
import
sysconfig
# The setuptools package is not installed by default on a clean
# Ubuntu. Might be also a case on Windows. Also Python Eggs
# and Wheels can be created only with setuptools.
try
:
from
setuptools
import
setup
from
setuptools
.
command
.
install
import
install
from
setuptools
.
dist
import
Distribution
print
(
"[setup.py] Using setuptools"
)
except
ImportError
:
from
distutils
.
core
import
setup
from
distutils
.
command
.
install
import
install
from
distutils
.
dist
import
Distribution
print
(
"[setup.py] Using distutils"
)
if
"bdist_wheel"
in
sys
.
argv
:
print
(
"[setup.py] ERROR: You must install setuptools package using"
" pip tool to be able to create a wheel package. Type"
" 'pip install setuptools'."
)
sys
.
exit
(
1
)
# Need to know which files are executables to set appropriate execute
# permissions during post_install_hook. On Windows .exe postfix will
# be added to these automatically.
EXECUTABLES_NOEXT
=
[
"cefclient"
,
"cefsimple"
,
"ceftests"
,
"subprocess"
,
]
class
custom_install
(
install
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
install
.
__init__
(
self
,
*
args
,
**
kwargs
)
def
run
(
self
):
install
.
run
(
self
)
post_install_hook
()
class
BinaryDistribution
(
Distribution
):
def
is_pure
(
self
):
return
False
# Provide a custom install command
print
(
"[setup.py] Overload install command to enable execution of"
" post install hook"
)
cmdclass
=
{
"install"
:
custom_install
}
# Set custom platform tags on Mac when generating wheel package. See:
# http://lepture.com/en/2014/python-on-a-hard-wheel
if
platform
.
system
()
==
"Darwin"
and
"bdist_wheel"
in
sys
.
argv
:
print
(
"[setup.py] Overload bdist_wheel command to add custom"
" platform tags"
)
from
wheel
.
bdist_wheel
import
bdist_wheel
class
custom_bdist_wheel
(
bdist_wheel
):
def
get_tag
(
self
):
tag
=
bdist_wheel
.
get_tag
(
self
)
platform_tag
=
(
"macosx_10_6_intel"
".macosx_10_9_intel.macosx_10_9_x86_64"
".macosx_10_10_intel.macosx_10_10_x86_64"
)
tag
=
(
tag
[
0
],
tag
[
1
],
platform_tag
)
return
tag
cmdclass
[
"bdist_wheel"
]
=
custom_bdist_wheel
elif
platform
.
system
()
in
[
"Windows"
,
"Linux"
]
and
"bdist_wheel"
in
sys
.
argv
:
# On Windows and Linux platform tag is always "any".
print
(
"[setup.py] Overload bdist_wheel command to fix platform tag"
)
from
wheel
.
bdist_wheel
import
bdist_wheel
class
custom_bdist_wheel
(
bdist_wheel
):
def
get_tag
(
self
):
tag
=
bdist_wheel
.
get_tag
(
self
)
platform_tag
=
sysconfig
.
get_platform
()
tag
=
(
tag
[
0
],
tag
[
1
],
platform_tag
)
return
tag
cmdclass
[
"bdist_wheel"
]
=
custom_bdist_wheel
def
main
():
setup
(
distclass
=
BinaryDistribution
,
cmdclass
=
cmdclass
,
name
=
"cefpython3"
,
# No spaces here, so that it works with deb pkg
version
=
"{{VERSION}}"
,
description
=
"GUI toolkit for embedding a Chromium widget"
" in desktop applications"
,
license
=
"BSD 3-clause"
,
author
=
"Czarek Tomczak"
,
author_email
=
"czarek.tomczak@@gmail.com"
,
url
=
"https://github.com/cztomczak/cefpython"
,
download_url
=
"https://github.com/cztomczak/cefpython/releases"
,
platforms
=
[
"{{SYSCONFIG_PLATFORM}}"
],
packages
=
[
"cefpython3"
],
# Disabled: "cefpython3.wx"
package_data
=
get_package_data
(),
classifiers
=
[
"Development Status :: 6 - Mature"
,
"Intended Audience :: Developers"
,
"License :: OSI Approved :: BSD License"
,
"Natural Language :: English"
,
"Operating System :: MacOS :: MacOS X"
,
"Operating System :: Microsoft :: Windows"
,
"Operating System :: POSIX :: Linux"
,
"Programming Language :: Python :: 2.7"
,
"Programming Language :: Python :: 3.4"
,
"Programming Language :: Python :: 3.5"
,
"Programming Language :: Python :: 3.6"
,
"Topic :: Desktop Environment"
,
"Topic :: Internet"
,
"Topic :: Internet :: WWW/HTTP"
,
"Topic :: Internet :: WWW/HTTP :: Browsers"
,
"Topic :: Multimedia"
,
(
"Topic :: Software Development :: Libraries"
":: Application Frameworks"
),
"Topic :: Software Development :: User Interfaces"
,
],
)
if
"install"
in
sys
.
argv
:
print
(
"[setup.py] OK installed"
)
elif
"bdist_wheel"
in
sys
.
argv
:
print
(
"[setup.py] OK created wheel package in dist/ directory"
)
else
:
print
(
"[setup.py] Unknown command line arguments"
)
def
get_package_data
():
package_data
=
{
"cefpython3"
:
get_package_files
()}
return
package_data
def
get_package_files
(
relative_dir
=
"."
,
recursive
=
False
):
"""Finds files recursively in the cefpython3/ local directory.
Includes only files and their paths are relative to the cefpython3/
local directory. Empty directories are not included."""
old_dir
=
None
if
not
recursive
:
old_dir
=
os
.
getcwd
()
setup_dir
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
__file__
))
local_pkg_dir
=
os
.
path
.
join
(
setup_dir
,
"cefpython3"
)
os
.
chdir
(
local_pkg_dir
)
files
=
os
.
listdir
(
relative_dir
)
ret
=
list
()
for
fpath
in
files
:
fpath
=
os
.
path
.
join
(
relative_dir
,
fpath
)
if
os
.
path
.
isdir
(
fpath
):
ret
.
extend
(
get_package_files
(
relative_dir
=
fpath
,
recursive
=
True
))
else
:
ret
.
append
(
fpath
)
if
not
recursive
:
os
.
chdir
(
old_dir
)
return
ret
def
get_executables
():
data
=
copy
.
copy
(
EXECUTABLES_NOEXT
)
if
platform
.
system
()
==
"Windows"
:
for
key
,
executable
in
enumerate
(
data
):
data
[
key
]
+=
".exe"
return
data
def
post_install_hook
():
"""Post install hook to chmod files on Linux and Mac."""
# Nothing extra required to do on Windows
if
platform
.
system
()
==
"Windows"
:
print
(
"[setup.py] post_install_hook is ignored on Windows"
)
return
# If this a wheel package generation then do not execute the hook
if
"bdist_wheel"
in
sys
.
argv
:
print
(
"[setup.py] Ignoring post_install_hook as this is bdist_wheel"
)
return
print
(
"[setup.py] Execute post_install_hook"
)
# Find the installed package directory. Do not import from
# the local cefpython3/ directory.
print
(
"[setup.py] Overload sys.path to facilitate finding correct"
" directory for the installed package"
)
del
sys
.
path
[
0
]
sys
.
path
.
append
(
""
)
import
cefpython3
installed_package_dir
=
os
.
path
.
dirname
(
cefpython3
.
__file__
)
# Make sure that the imported package wasn't the local cefptyhon3/
# directory.
print
(
"[setup.py] Installed package directory: {dir}"
.
format
(
dir
=
installed_package_dir
))
assert
not
installed_package_dir
.
startswith
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)))
# Set permissions on executables
print
(
"[setup.py] Set execute permissions on executables"
)
for
executable
in
get_executables
():
executable
=
os
.
path
.
join
(
installed_package_dir
,
executable
)
command
=
"chmod +x {executable}"
.
format
(
executable
=
executable
)
print
(
"[setup.py] {command}"
.
format
(
command
=
command
))
subprocess
.
call
(
command
,
shell
=
True
)
# Set write permissions on log files
print
(
"[setup.py] Set write permissions on log files"
)
package_data
=
get_package_data
()
for
pkgfile
in
package_data
:
if
not
pkgfile
.
endswith
(
".log"
):
continue
logfile
=
os
.
path
.
join
(
installed_package_dir
,
pkgfile
)
command
=
"chmod 666 {logfile}"
.
format
(
logfile
=
logfile
)
print
(
"[setup.py] {command}"
.
format
(
command
=
command
))
subprocess
.
call
(
command
,
shell
=
True
)
if
__name__
==
"__main__"
:
main
()
You can’t perform that action at this time.