Convert makefile to shell commands in appveyor config, various other tweaks

This commit is contained in:
blitzmann
2022-03-23 10:28:04 -04:00
parent f7ea438ebc
commit b1beebda26
11 changed files with 96 additions and 166 deletions

View File

@@ -1,9 +1,83 @@
image:
- Visual Studio 2019
- Ubuntu
- macos
clone_depth: 400
clone_depth: 1
for:
-
matrix:
only:
- image: Ubuntu
environment:
APPVEYOR_SSH_KEY: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDJDW/+oYNGOiPvwuwAL9tc/LQgg58aosIVpMYfepQZ20V+VZnHpZh8IRDA8Jo5xht19p2PksA+hFgqA0kpKtrSkuiWdE8rATQItfk4gf7yB0yGasJGGQZYazy9k/9XtmYkq2HHOOeEqdxvrICddJQ88MLCLT9lJENSUP/YS/yGcjZFXVxE11pTeIcqlCRU+3eYa1v7BeNvXIKNhZoK5orXWrtuH3cy8jrSns/u70aYfJ6B2jA8CnWnDbuvpeQtEY61SQqlKUsSArNa8NAsXj41wr3Ar9gAG9330w7EMTqlutk8HZO35uHI0q5qinUhaQYufPPrVkb2L/N+ZCfu0fnh appveyor"
APPIMAGE_TOOL: appimagetool-x86_64.AppImage
PYTHON_APPIMAGE: python3.7.13-cp37-cp37m-manylinux2014_x86_64.AppImage
DEPLOY_DIR: AppDir/opt/pyfa
# APPVEYOR_SSH_BLOCK: true
cache:
- /home/appveyor/.cache/pip -> requirements.txt
init:
- sh: curl -sflL 'https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-ssh.sh' | bash -e -
install:
- sh: git fetch --prune --unshallow # to fix the version dump issues
- sh: sudo DEBIAN_FRONTEND=noninteractive apt-get -y update
- sh: sudo DEBIAN_FRONTEND=noninteractive apt-get -y install python3.7-dev libgtk-3-dev python3-pip libwebkit2gtk-4.0-dev
before_build:
- sh: mkdir build && cd build
- sh: curl -LO https://github.com/AppImage/AppImageKit/releases/download/13/$APPIMAGE_TOOL && chmod +x $APPIMAGE_TOOL
- sh: curl -LO https://github.com/niess/python-appimage/releases/download/python3.7/$PYTHON_APPIMAGE && chmod +x $PYTHON_APPIMAGE
build_script:
# Prepare Python base AppImage, stripping Python metadata
- sh: ./$PYTHON_APPIMAGE --appimage-extract
- sh: mv squashfs-root AppDir
- sh: rm AppDir/python*.desktop
- sh: rm AppDir/usr/share/applications/*.desktop
- sh: rm AppDir/usr/share/metainfo/*.appdata.xml
- sh: mkdir -p $DEPLOY_DIR
# run install pyfa packages and any other requirements
- sh: AppDir/usr/bin/python -s -m pip install -U pip setuptools==41.6.0 wheel pathlib2
- sh: AppDir/usr/bin/python -s -m pip install -r ../requirements.txt
# Run scripts to prep pyfa data and build database
- sh: cd ../
- sh: find locale/ -type f -name "*.po" -exec msgen "{}" -o "{}" \;
- sh: build/AppDir/usr/bin/python scripts/compile_lang.py
- sh: build/AppDir/usr/bin/python scripts/dump_crowdin_progress.py
- sh: build/AppDir/usr/bin/python db_update.py
- sh: export PYFA_VERSION="$(python3.7 scripts/dump_version.py)"
# Copy pyfa files to host
- sh: cp -r eos graphs gui imgs locale service utils eve.db config.py pyfa.py db_update.py README.md LICENSE version.yml ./build/$DEPLOY_DIR
- sh: find ./build/$DEPLOY_DIR | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf
# Copy static AppImage files
- sh: cd dist_assets/linux
- sh: cp AppRun pyfa.desktop ../../build/AppDir/
- sh: cp pyfa.desktop ../../build/AppDir/usr/share/applications/
- sh: cp org.pyfa.pyfa.appdata.xml ../../build/AppDir/usr/share/metainfo/
- sh: chmod +x pyfa && cp pyfa ../../build/AppDir/usr/bin
- sh: cd ../../
# Package it all up
- sh: mkdir dist
- sh: ./build/$APPIMAGE_TOOL build/AppDir dist/pyfa-$PYFA_VERSION-linux.AppImage
after_build:
- sh: ls -la build
artifacts:
- path: dist/pyfa-$PYFA_VERSION-linux.AppImage
deploy:
tag: $PYFA_VERSION
release: pyfa $PYFA_VERSION
description: 'Release description'
provider: GitHub
auth_token:
secure: M94o0xMtzxrvlKpqMcXU2KfbJdd3aYJ3UxWzePUz/pkT1/Ojiis052CiLsLVyzJg
draft: true
force_update: false
# deploy on tag push only
on:
APPVEYOR_REPO_TAG: true
-
matrix:
only:
@@ -13,7 +87,11 @@ for:
# Should be enabled only for build process debugging
# init:
# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
cache:
- C:\users\appveyor\appdata\local\pip\cache\ -> requirements.txt
install:
- cmd: git fetch --prune --unshallow # to fix the version dump issues
- ps: echo("OS version:")
- ps: "[System.Environment]::OSVersion.Version"
@@ -96,11 +174,15 @@ for:
matrix:
only:
- image: macos
# Should be enabled only for build process debugging
environment:
APPVEYOR_SSH_KEY: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDJDW/+oYNGOiPvwuwAL9tc/LQgg58aosIVpMYfepQZ20V+VZnHpZh8IRDA8Jo5xht19p2PksA+hFgqA0kpKtrSkuiWdE8rATQItfk4gf7yB0yGasJGGQZYazy9k/9XtmYkq2HHOOeEqdxvrICddJQ88MLCLT9lJENSUP/YS/yGcjZFXVxE11pTeIcqlCRU+3eYa1v7BeNvXIKNhZoK5orXWrtuH3cy8jrSns/u70aYfJ6B2jA8CnWnDbuvpeQtEY61SQqlKUsSArNa8NAsXj41wr3Ar9gAG9330w7EMTqlutk8HZO35uHI0q5qinUhaQYufPPrVkb2L/N+ZCfu0fnh appveyor"
cache:
- /Users/appveyor/Library/Caches/pip/ -> requirements.txt
init:
# - sh: curl -sflL 'https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-ssh.sh' | bash -e -
- sh: source ~/venv3.7/bin/activate
install:
- sh: git fetch --prune --unshallow # to fix the version dump issues
- sh: bash scripts/osx-setup.sh
build_script:
- sh: bash scripts/osx-translations.sh
@@ -110,6 +192,9 @@ for:
after_build:
- sh: export PYFA_VERSION="$(python3 scripts/dump_version.py)"
- sh: bash scripts/osx-package.sh
# on_finish:
# - sh: export APPVEYOR_SSH_BLOCK=true
# - sh: curl -sflL 'https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-ssh.sh' | bash -e -
artifacts:
- path: dist/pyfa*-mac.zip
before_deploy:
@@ -126,4 +211,4 @@ for:
force_update: false
# deploy on tag push only
on:
APPVEYOR_REPO_TAG: true
APPVEYOR_REPO_TAG: true

View File

@@ -1,67 +0,0 @@
APPIMAGETOOL:=appimagetool-x86_64.AppImage
APPIMAGETOOL_URL:=https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-x86_64.AppImage
PYTHON_APPIMAGE=python3.8.12-cp38-cp38-manylinux2014_x86_64.AppImage
PYTHON_APPIMAGE_URL=https://github.com/niess/python-appimage/releases/download/python3.8/$(PYTHON_APPIMAGE)
DEPLOY_DIR=AppDir/opt/pyfa
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
PYFA_DIR:=$(realpath $(ROOT_DIR)/..)
EVE_DB:=$(DEPLOY_DIR)/eve.db
# Relative to Pyfa/ dir
PROJECT_FILES=README.md LICENSE eos graphs gui imgs locale scripts service staticdata utils version.yml config.py db_update.py pyfa.py
PROJECT_SOURCES=$(patsubst %, $(DEPLOY_DIR)/%, $(PROJECT_FILES))
# Just so the final appimage is rebuilt when these change
APPIMAGE_FILES=AppRun org.pyfa.pyfa.appdata.xml pyfa pyfa.desktop
APPIMAGE_SOURCES=$(patsubst %, $(ROOT_DIR)/%, $(APPIMAGE_FILES))
Pyfa-x86_64.AppImage: $(PROJECT_SOURCES) | $(APPIMAGETOOL) static deps $(EVE_DB)
./$(APPIMAGETOOL) AppDir
$(EVE_DB): $(PYFA_DIR)/eos $(PYFA_DIR)/db_update.py deps
AppDir/usr/bin/python -s $(DEPLOY_DIR)/db_update.py
.PHONY: deps
deps: $(DEPLOY_DIR) $(PYFA_DIR)/requirements.txt
AppDir/usr/bin/python -s -m pip install -U pip setuptools wheel
AppDir/usr/bin/python -s -m pip install -r $(PYFA_DIR)/requirements.txt
.PHONY: static
static: $(DEPLOY_DIR) $(APPIMAGE_SOURCES)
cp $(ROOT_DIR)/AppRun AppDir/
cp $(ROOT_DIR)/pyfa.desktop AppDir/
cp $(ROOT_DIR)/pyfa.desktop AppDir/usr/share/applications/
cp $(ROOT_DIR)/org.pyfa.pyfa.appdata.xml AppDir/usr/share/metainfo/
chmod +x $(ROOT_DIR)/pyfa && cp $(ROOT_DIR)/pyfa AppDir/usr/bin/
# Rule to copy generated PROJECT_SOURCES
$(DEPLOY_DIR)/%: $(PYFA_DIR)/% $(DEPLOY_DIR)
cp -r $< $@
# Prepare Python base AppImage, stripping Python metadata
$(DEPLOY_DIR): $(PYTHON_APPIMAGE)
./$(PYTHON_APPIMAGE) --appimage-extract
mv squashfs-root AppDir
rm AppDir/python*.desktop
rm AppDir/usr/share/applications/*.desktop
rm AppDir/usr/share/metainfo/*.appdata.xml
mkdir -p $(DEPLOY_DIR)
$(PYTHON_APPIMAGE):
curl -LO $(PYTHON_APPIMAGE_URL)
chmod +x $(PYTHON_APPIMAGE)
$(APPIMAGETOOL):
curl -LO $(APPIMAGETOOL_URL)
chmod +x $(APPIMAGETOOL)
clean:
rm -rf AppDir
clean-all: clean
rm -rf *.AppImage

View File

@@ -1,20 +0,0 @@
## Pyfa As AppImage
Needed for building:
- Linux distro, currently tested is Arch/Manjaro
- make, curl
- GTK3 libraries are needed (`gtk3` for Arch based, `libgtk-3-dev` for debian based)
- patience, first time building wxPython can take about 10 minutes
Steps:
```sh
cd appimage
mkdir build
cd build
make -f ../Makefile
```
If everything goes alright, build directory should contain `Pyfa-x86_64.AppImage`.

View File

@@ -1,3 +0,0 @@
#! /bin/bash
${APPDIR}/usr/bin/python3.8 -s "${APPDIR}/opt/pyfa/pyfa.py" "$@"

3
dist_assets/linux/pyfa Normal file
View File

@@ -0,0 +1,3 @@
#! /bin/bash
${APPDIR}/usr/bin/python3.7 -s "${APPDIR}/opt/pyfa/pyfa.py" "$@"

View File

@@ -1,70 +0,0 @@
# -*- mode: python -*-
import os
from itertools import chain
import subprocess
label = subprocess.check_output([
"git", "describe", "--tags"]).strip()
with open('gitversion', 'w+') as f:
f.write(label.decode())
block_cipher = None
added_files = [
( 'imgs/gui/*.png', 'imgs/gui' ),
( 'imgs/gui/*.gif', 'imgs/gui' ),
( 'imgs/icons/*.png', 'imgs/icons' ),
( 'imgs/renders/*.png', 'imgs/renders' ),
( 'dist_assets/win/pyfa.ico', '.' ),
( 'dist_assets/cacert.pem', '.' ),
( 'eve.db', '.' ),
( 'README.md', '.' ),
( 'LICENSE', '.' ),
( 'gitversion', '.' ),
]
import_these = []
# Walk directories that do dynamic importing
paths = ('eos/effects', 'eos/db/migrations', 'service/conversions')
for root, folders, files in chain.from_iterable(os.walk(path) for path in paths):
for file_ in files:
if file_.endswith(".py") and not file_.startswith("_"):
mod_name = "{}.{}".format(
root.replace("/", "."),
file_.split(".py")[0],
)
import_these.append(mod_name)
a = Analysis(['pyfa.py'],
pathex=[],
binaries=[],
datas=added_files,
hiddenimports=import_these,
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
exclude_binaries=True,
name='pyfa',
debug=False,
strip=False,
upx=True,
console=True )
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
name='pyfa')

View File

@@ -1,4 +1,4 @@
wxPython <4.1
wxPython == 4.0.6
logbook >= 1.0.0
numpy == 1.19.2
matplotlib == 3.2.2
@@ -12,4 +12,4 @@ roman >= 2.0.0
beautifulsoup4 >= 4.6.0
pyyaml >= 5.1
python-jose==3.0.1
requests-cache==0.8.1
requests-cache==0.8.1

View File

@@ -7,5 +7,7 @@ echo "Building distributive..."
python3 -m PyInstaller -y --clean --windowed dist_assets/mac/pyfa.spec
echo "Compressing distributive..."
cd dist
/usr/libexec/PlistBuddy -c "Add :CFBundleVersion string ${PYFA_VERSION}" "pyfa.app/Contents/Info.plist" # Add missing
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${PYFA_VERSION}" "pyfa.app/Contents/Info.plist" # Modify existing
zip -r "pyfa-$PYFA_VERSION-mac.zip" pyfa.app
md5 -r "pyfa-$PYFA_VERSION-mac.zip"