-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature] Change the build method from pyinstaller to cx_Freeze.
将pyinstaller构建方式更改为cx_Freeze
- Loading branch information
Showing
7 changed files
with
102 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -5,5 +5,6 @@ | |
/venv | ||
/release | ||
/.idea | ||
/venv.* | ||
/bookmark.html | ||
/bookmark.json |
This file contains 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 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 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 |
---|---|---|
@@ -1,3 +1,56 @@ | ||
#!/bin/bash | ||
./venv/bin/pyinstaller main.py -F -n arc-bookmarks | ||
chmod +x dist/arc-bookmarks | ||
|
||
set -e | ||
|
||
echo_success() { | ||
echo -e "\033[32m$1\033[0m" | ||
} | ||
|
||
echo_error() { | ||
echo -e "\033[31m$1\033[0m" | ||
} | ||
|
||
build() { | ||
platform=$1 | ||
echo_success "========= Building for $platform =========" | ||
|
||
if [ "$platform" = "x86_64" ]; then | ||
arch_prefix="arch -x86_64" | ||
brew_prefix="/usr/local" | ||
elif [ "$platform" = "arm64" ]; then | ||
arch_prefix="arch -arm64" | ||
brew_prefix="/opt/homebrew" | ||
else | ||
echo_error "Invalid platform" | ||
exit 1 | ||
fi | ||
|
||
eval "$($arch_prefix $brew_prefix/bin/brew shellenv)" | ||
|
||
if [ ! -d ./venv.$platform ]; then | ||
echo_success "Creating venv.$platform" | ||
${brew_prefix}/bin/python3 -m venv ./venv.$platform | ||
fi | ||
|
||
# echo "Activating venv.$platform" | ||
# source ./venv.$platform/bin/activate | ||
|
||
echo_success "Installing requirements" | ||
$arch_prefix ./venv.$platform/bin/pip3 install -r requirements.txt | ||
|
||
echo_success "Building arc-bookmarks" | ||
build_name="arc-bookmarks.macos.$platform" | ||
$arch_prefix ./venv.$platform/bin/cxfreeze -c main.py --target-name=arc-bookmarks --target-dir=build/$build_name | ||
chmod +x build/$build_name/arc-bookmarks | ||
cd build | ||
zip -r $build_name.zip $build_name -9 | ||
rm -rf $build_name | ||
cd .. | ||
|
||
echo_success "Build successful" | ||
} | ||
|
||
rm -rf build | ||
|
||
build x86_64 | ||
build arm64 |
This file contains 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 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 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,2 @@ | ||
requests | ||
cx_Freeze |