Skip to content
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

msys2 #100

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

msys2 #100

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions .github/workflows/msys2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@

name: msys2
on: push
jobs:
Deploy-on-windows:
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
update: true
install: >-
base-devel
git
mingw-w64-ucrt-x86_64-python-pip
mingw-w64-ucrt-x86_64-nsis
mingw-w64-ucrt-x86_64-nsis-nsisunz
mingw-w64-ucrt-x86_64-gcc
zip
unzip
p7zip
mingw-w64-ucrt-x86_64-python-pyqt5
python-setuptools
mingw-w64-ucrt-x86_64-python-pyserial
mingw-w64-ucrt-x86_64-python-requests
mingw-w64-ucrt-x86_64-python-babel
mingw-w64-ucrt-x86_64-python-qtawesome
mingw-w64-ucrt-x86_64-python-paramiko
mingw-w64-ucrt-x86_64-python-pyperclip
mingw-w64-ucrt-x86_64-python-pyqtgraph
- name: Check out repository code
uses: actions/checkout@v3
- name: Running pyinstaller without pack.py
run: |
APP=comtool
if [ ! -d venv ]; then
python3 -m venv --system-site-packages venv
. venv/bin/activate
python3 -m pip install --upgrade pip
PYINSTALLER_COMPILE_BOOTLOADER=1 PYI_STATIC_ZLIB=1 python3 -m pip install -r requirements.txt
python3 -m pip install git+https://github.com/pyinstaller/pyinstaller.git
else
. venv/bin/activate
fi

python3 -m pip install wheel pyinstaller-hooks-contrib
python3 setup.py sdist bdist_wheel
python3 pack.py
# python3 -m PyInstaller $APP.spec -y
# echo "Preparing app..."
# cd dist/$APP
# zip -r $APP.zip *
# mv $APP.zip ../..
# cd ../..
echo $(du -sk dist/$APP | cut -f 1) > INSTALLSIZE
echo $(uname -m) > ARCH
echo "Running makensis..."
makensis $APP.nsi

python3 -m PyInstaller $APP-portable.spec
echo "Preparing app..."
version=$(cat VERSION)
mv dist/$APP.exe ./$APP-$version-$(uname -m)-portable.exe
- name: List files
run: ls -R
- name: Upload output files
uses: actions/upload-artifact@v3
with:
name: EXE
path: comtool*.exe
retention-days: 5
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.2.1
40 changes: 40 additions & 0 deletions comtool-portable.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# -*- mode: python ; coding: utf-8 -*-


block_cipher = None


a = Analysis(
['COMTool/Main.py'],
pathex=['COMTool'],
binaries=[],
datas=[('COMTool/assets', 'assets'), ('COMTool/locales', 'locales'), ('COMTool/protocols', 'protocols'), ('README.MD', './'), ('README_ZH.MD', './')],
hiddenimports=['babel.numbers'],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)

exe = EXE(
pyz,
a.scripts,
[],
name='comtool',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=False,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
icon=['COMTool/assets/logo.ico'],
)
79 changes: 79 additions & 0 deletions comtool.nsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/usr/bin/makensis

!define APPNAME "comtool"
!define FILENAME "comtool"
!define AUTHOR "Author name"
!define DESCRIPTION "com debug tool"

Unicode True

!define /file VERSION "VERSION"
!define /file INSTALLSIZE "INSTALLSIZE"
!define /file ARCH "ARCH"

InstallDir "$PROGRAMFILES\${APPNAME}"

Name "${APPNAME}"
Icon "COMTool/assets/logo.ico"
outFile "${FILENAME}-${VERSION}-${ARCH}.exe"

!include LogicLib.nsh

Page directory
Page instfiles

!macro VerifyUserIsAdmin
UserInfo::GetAccountType
pop $0
${If} $0 != "admin" ;Require admin rights on NT4+
messageBox mb_iconstop "Administrator rights required!"
setErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
quit
${EndIf}
!macroend

function .onInit
setShellVarContext all
!insertmacro VerifyUserIsAdmin
functionEnd

section "install"

setOutPath $INSTDIR
file "COMTool\assets\logo.ico"
file "${FILENAME}.zip"

nsisunz::Unzip "$INSTDIR\${FILENAME}.zip" "$INSTDIR"

delete "$INSTDIR\${FILENAME}.zip"

writeUninstaller "$INSTDIR\uninstall.exe"

createDirectory "$SMPROGRAMS\${APPNAME}"
createShortCut "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk" "$INSTDIR\${FILENAME}.exe" "" "$INSTDIR\COMTool\assets\logo.ico.ico"

WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayName" "${APPNAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "InstallLocation" "$\"$INSTDIR$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayIcon" "$\"$INSTDIR\COMTool\assets\logo.ico$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "Publisher" "${AUTHOR}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayVersion" "${VERSION}"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "NoRepair" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "EstimatedSize" ${INSTALLSIZE}
sectionEnd

function un.onInit
SetShellVarContext all
MessageBox MB_OKCANCEL "Permanently remove ${APPNAME}?" IDOK next
Abort
next:
!insertmacro VerifyUserIsAdmin
functionEnd

section "uninstall"
rmDir /r /REBOOTOK "$SMPROGRAMS\${APPNAME}"
rmDir /r /REBOOTOK $INSTDIR
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}"
sectionEnd
7 changes: 4 additions & 3 deletions pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@

linux_out = "comtool_ubuntu_v{}.tar.xz".format(version.__version__)
macos_out = "comtool_macos_v{}.dmg".format(version.__version__)
windows_out = "comtool_windows_v{}.7z".format(version.__version__)
windows_out_7z = "comtool_windows_v{}.7z".format(version.__version__)
windows_out_zip = "comtool.zip"

def zip(out, path):
out = os.path.abspath(out)
Expand Down Expand Up @@ -135,8 +136,8 @@ def pack():
print("files in dist dir:", os.listdir("dist"))
shutil.copyfile("./dist/comtool 0.0.0.dmg", macos_out)
elif sys.platform.startswith("win32"):
# zip(windows_out, "dist/comtool")
zip_7z(windows_out, "dist/comtool")
zip(windows_out_zip, "dist/comtool")
# zip_7z(windows_out_7z, "dist/comtool")
else:
cmd = "cd dist && tar -Jcf {} comtool/ && mv {} ../ && cd ..".format(linux_out, linux_out)
ret = os.system(cmd)
Expand Down