Replies: 8 comments 9 replies
-
It should work to obfuscate the scripts with 2 platforms In future pyarmor may support universal extensions by plugin like |
Beta Was this translation helpful? Give feedback.
-
Please upgrade Pyarmor to 8.3.1, and try it again. |
Beta Was this translation helpful? Give feedback.
-
Apply this patch, diff --git a/pyarmor/cli/plugin.py b/pyarmor/cli/plugin.py
index 57c7d0ae..6d2bc245 100644
--- a/pyarmor/cli/plugin.py
+++ b/pyarmor/cli/plugin.py
@@ -246,6 +246,9 @@ class DarwinUniversalPlugin:
f.write(''.join(lines))
rtpath = os.path.join(outputs[0], ctx.runtime_package_name)
+ # Fix repack issue, it changes output path
+ if not os.path.exists(rtpath):
+ rtpath = os.path.join(ctx.repack_path, ctx.runtime_package_name)
dirs = [x.name for x in os.scandir(rtpath) if x.is_dir()]
plats = set(['darwin_x86_64', 'darwin_arm64', 'darwin_aarch64'])
plats = plats.intersection(set(dirs)) |
Beta Was this translation helpful? Give feedback.
-
Please check path make sure there is If there is no Also check |
Beta Was this translation helpful? Give feedback.
-
No idea, this plugin works fine in my machine. |
Beta Was this translation helpful? Give feedback.
-
The problem is that Another hint, if you have many virtual environments, using You can only test All the plugin code are open in |
Beta Was this translation helpful? Give feedback.
-
Thanks for your solutions. It seems the following commands will generate 2 executable files
I had thought there is only But I have a question, this patch just copy all the obfuscated scripts and runtime package from
But if there is option rm -rf ./dist ./build ./.pyarmor ~/macos-build-venv ./test.spec ./obfdist ./test_run_logs.txt
cwd=$(pwd)
python3 -m venv ~/macos-build-venv/
cd ~/macos-build-venv/
source ./bin/activate
cd $cwd
pip install --upgrade --force-reinstall -r ./src/main/resources/requirements.txt
pyi-makespec --name test --target-architecture universal2 --windowed --onefile ./src/main/python/test.py"
pyinstaller ./test.spec
pyarmor gen --platform darwin.x86_64,darwin.arm64 --pack ./dist/test ./src/main/python/*
pyarmor gen --platform darwin.x86_64,darwin.arm64 --pack ./dist/test.app/Contents/MacOS/test ./src/main/python/* |
Beta Was this translation helpful? Give feedback.
-
I have no experience in GitHub Actions, could you test the following action? The difference is
name: CI/CD
on: {pull_request: {branches: ["main"]}}
jobs:
build:
runs-on: macos-13
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with: {python-version: '3.11.3'}
- name: Build
run: |
rm -rf ./dist ./build ./.pyarmor ~/macos-venv ./test.spec ./obfdist
python3 -m venv ~/macos-venv/ && chmod +x ~/macos-venv/bin/activate && ~/macos-venv/bin/activate
pip install --upgrade --force-reinstall pyinstaller==5.11.0 pyarmor==8.3.1 pyarmor.cli.core.darwin==4.3.1
echo "$PATCHED_CODE" >> ~/macos-build-venv/lib/python3.11/site-packages/pyarmor/cli/plugin.py
mkdir -p "./src/main/python" && touch "./src/main/python/test.py"
pyi-makespec --name test --target-architecture universal2 --windowed ./src/main/python/test.py
pyinstaller ./test.spec
pyarmor -d gen --platform darwin.x86_64,darwin.arm64 --pack ./dist/test.app/Contents/MacOS/test ./src/main/python/* The PATCHED_CODE is logger.debug('DarwinUniversalPlugin enabled')
logger.debug('plugin rtpath is "%s", it exists %s', rtpath, os.path.exists(rtpath))
logger.debug('plats is %s', plats)
if os.path.exists(rtpath):
logger.debug('listdir(rtpath) is %s', os.listdir(rtpath)) |
Beta Was this translation helpful? Give feedback.
-
PyInstaller currently has the ability to package your python application with a target architecture of universal2 .
https://pyinstaller.org/en/stable/man/pyi-makespec.html?highlight=--target-arch#mac-os-specific-options
This allows the developer to ship one distributable for both Intel and Apple Silicone based Apple hardware.
I have successfully built a universal2 application using only PyInstaller that works on both Intel and Apple Silicone.
However, when I take that same application and run it through pyarmor it would appear to remove the multi-architecture support.
For example, when I run pyarmor on an Intel based Mac I get the following error when trying to run the application on an M1 Mac.
Is there a way to get pyarmor to also use a
pyarmor_runtime.so
that is universal2 compatible?Does pyarmor suggest that developers ship two separate versions of their application?
An Intel version of the application and an Apple Silicone version?
Beta Was this translation helpful? Give feedback.
All reactions