-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Initial support for PySide6 and Qt #2918
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
4f746d1
Initial support for PySide6
ShyamQt 35118f4
Add Qt boostrap to docs
ShyamQt dfb3f10
Tweak gradle build properties for Qt bootstrap
ShyamQt 99250f1
Fix bug - check for main.py
ShyamQt 46ad2b2
Make --init-classes truly optional
ShyamQt cbf953a
Add a non-gui test app build to CI that uses Qt bootstrap
ShyamQt 4b05cc6
Remove superfluous whitespace removal
ShyamQt 6b3a543
Add aab generation to test app with Qt bootstrap
ShyamQt c4fe700
Fix typo in doc/source/buildoptions.rst
shyamnathp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
pythonforandroid/bootstraps/common/build/templates/gradle.tmpl.properties
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import sh | ||
from os.path import join | ||
from pythonforandroid.toolchain import ( | ||
Bootstrap, current_directory, info, info_main, shprint) | ||
from pythonforandroid.util import ensure_dir, rmdir | ||
|
||
|
||
class QtBootstrap(Bootstrap): | ||
name = 'qt' | ||
recipe_depends = ['python3', 'genericndkbuild', 'PySide6', 'shiboken6'] | ||
# this is needed because the recipes PySide6 and shiboken6 resides in the PySide Qt repository | ||
# - https://code.qt.io/cgit/pyside/pyside-setup.git/ | ||
# Without this some tests will error because it cannot find the recipes within pythonforandroid | ||
# repository | ||
can_be_chosen_automatically = False | ||
|
||
def assemble_distribution(self): | ||
info_main("# Creating Android project using Qt bootstrap") | ||
|
||
rmdir(self.dist_dir) | ||
info("Copying gradle build") | ||
shprint(sh.cp, '-r', self.build_dir, self.dist_dir) | ||
|
||
with current_directory(self.dist_dir): | ||
with open('local.properties', 'w') as fileh: | ||
fileh.write('sdk.dir={}'.format(self.ctx.sdk_dir)) | ||
|
||
arch = self.ctx.archs[0] | ||
if len(self.ctx.archs) > 1: | ||
raise ValueError("Trying to build for more than one arch. Qt bootstrap cannot handle that yet") | ||
|
||
info(f"Bootstrap running with arch {arch}") | ||
|
||
with current_directory(self.dist_dir): | ||
info("Copying Python distribution") | ||
|
||
self.distribute_libs(arch, [self.ctx.get_libs_dir(arch.arch)]) | ||
self.distribute_aars(arch) | ||
self.distribute_javaclasses(self.ctx.javaclass_dir, | ||
dest_dir=join("src", "main", "java")) | ||
|
||
python_bundle_dir = join(f'_python_bundle__{arch.arch}', '_python_bundle') | ||
ensure_dir(python_bundle_dir) | ||
site_packages_dir = self.ctx.python_recipe.create_python_bundle( | ||
join(self.dist_dir, python_bundle_dir), arch) | ||
|
||
if not self.ctx.with_debug_symbols: | ||
self.strip_libraries(arch) | ||
self.fry_eggs(site_packages_dir) | ||
super().assemble_distribution() | ||
|
||
|
||
bootstrap = QtBootstrap() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.gradle | ||
/build/ | ||
|
||
# Ignore Gradle GUI config | ||
gradle-app.setting | ||
|
||
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) | ||
!gradle-wrapper.jar | ||
|
||
# Cache of project | ||
.gradletasknamecache | ||
|
||
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 | ||
# gradle/wrapper/gradle-wrapper.properties |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# prevent user to include invalid extensions | ||
*.apk | ||
*.aab | ||
*.apks | ||
*.pxd | ||
|
||
# eggs | ||
*.egg-info | ||
|
||
# unit test | ||
unittest/* | ||
|
||
# python config | ||
config/makesetup | ||
|
||
# unused encodings | ||
lib-dynload/*codec* | ||
encodings/cp*.pyo | ||
encodings/tis* | ||
encodings/shift* | ||
encodings/bz2* | ||
encodings/iso* | ||
encodings/undefined* | ||
encodings/johab* | ||
encodings/p* | ||
encodings/m* | ||
encodings/euc* | ||
encodings/k* | ||
encodings/unicode_internal* | ||
encodings/quo* | ||
encodings/gb* | ||
encodings/big5* | ||
encodings/hp* | ||
encodings/hz* | ||
|
||
# unused python modules | ||
bsddb/* | ||
wsgiref/* | ||
hotshot/* | ||
pydoc_data/* | ||
tty.pyo | ||
anydbm.pyo | ||
nturl2path.pyo | ||
LICENCE.txt | ||
macurl2path.pyo | ||
dummy_threading.pyo | ||
audiodev.pyo | ||
antigravity.pyo | ||
dumbdbm.pyo | ||
sndhdr.pyo | ||
__phello__.foo.pyo | ||
sunaudio.pyo | ||
os2emxpath.pyo | ||
multiprocessing/dummy* | ||
|
||
# unused binaries python modules | ||
lib-dynload/termios.so | ||
lib-dynload/_lsprof.so | ||
lib-dynload/*audioop.so | ||
lib-dynload/_hotshot.so | ||
lib-dynload/_heapq.so | ||
lib-dynload/_json.so | ||
lib-dynload/grp.so | ||
lib-dynload/resource.so | ||
lib-dynload/pyexpat.so | ||
lib-dynload/_ctypes_test.so | ||
lib-dynload/_testcapi.so | ||
|
||
# odd files | ||
plat-linux3/regen |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
# Uncomment this if you're using STL in your project | ||
# See CPLUSPLUS-SUPPORT.html in the NDK documentation for more information | ||
# APP_STL := stlport_static | ||
|
||
# APP_ABI := armeabi armeabi-v7a x86 | ||
APP_ABI := $(ARCH) | ||
APP_PLATFORM := $(NDK_API) |
18 changes: 18 additions & 0 deletions
18
pythonforandroid/bootstraps/qt/build/jni/application/src/Android.mk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
LOCAL_PATH := $(call my-dir) | ||
|
||
include $(CLEAR_VARS) | ||
|
||
LOCAL_MODULE := main_$(PREFERRED_ABI) | ||
|
||
# Add your application source files here... | ||
LOCAL_SRC_FILES := start.c | ||
|
||
LOCAL_CFLAGS += -I$(PYTHON_INCLUDE_ROOT) $(EXTRA_CFLAGS) | ||
|
||
LOCAL_SHARED_LIBRARIES := python_shared | ||
|
||
LOCAL_LDLIBS := -llog $(EXTRA_LDLIBS) | ||
|
||
LOCAL_LDFLAGS += -L$(PYTHON_LINK_ROOT) $(APPLICATION_ADDITIONAL_LDFLAGS) | ||
|
||
include $(BUILD_SHARED_LIBRARY) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.