Переглянути джерело

feat: package for Mac

pull/106/head
Jérôme Deuchnord 5 роки тому
джерело
коміт
79f43dbd62
Не вдалося знайти GPG ключ що відповідає даному підпису Ідентифікатор GPG ключа: 72F9D1A7272D53DD
6 змінених файлів з 48 додано та 59 видалено
  1. +1
    -0
      .gitignore
  2. +2
    -30
      Makefile
  3. +0
    -22
      build/distrib/darwin/Info.plist
  4. +0
    -7
      build/distrib/darwin/launch-kosmorro.sh
  5. +11
    -0
      kosmorro-gui
  6. +34
    -0
      setup-gui-app.py

+ 1
- 0
.gitignore Переглянути файл

@@ -17,3 +17,4 @@ coverage.xml
# Translation files are taken care on https://poeditor.com/join/project/GXuhLpdaoh
*.mo
*.po
/.eggs

+ 2
- 30
Makefile Переглянути файл

@@ -57,36 +57,8 @@ finish-release: env
@echo -e "Invoke \e[33mgit push origin master features v$$RELEASE_NUMBER\e[39m to finish."

distmacapp = dist/Kosmorro.app
dist-mac-app: env
@if [ -e $(distmacapp) ]; then echo "Deleting the existing app."; rm -rf $(distmacapp); fi
mkdir -p "$(distmacapp)/Contents/MacOS" "$(distmacapp)/Contents/Resources"

# Add application files
cp "kosmorro" "$(distmacapp)/Contents/MacOS/kosmorro"
cp -r "kosmorrolib" "$(distmacapp)/Contents/MacOS/kosmorrolib"
cp "Pipfile" "$(distmacapp)/Contents/MacOS/Pipfile"
cp "Pipfile.lock" "$(distmacapp)/Contents/MacOS/Pipfile.lock"

# Install dependencies
cd $(distmacapp)/Contents/MacOS && PIPENV_VENV_IN_PROJECT=1 pipenv sync
cd $(distmacapp)/Contents/MacOS && source .venv/bin/activate && pip install wxPython latex

# Add Python binaries and remove the links in the virtualenv
cp -r "$$(dirname $$(realpath $$(which python3)))/.." $(distmacapp)/Contents/MacOS/python
rm $(distmacapp)/Contents/MacOS/.venv/bin/python{,3,3.9}

# Add Mac-specific files
cp "build/distrib/darwin/Info.plist" "$(distmacapp)/Contents/Info.plist"
cp "build/distrib/darwin/launch-kosmorro.sh" "$(distmacapp)/Contents/MacOS/launch-kosmorro"
cp "build/distrib/darwin/icon.icns" "$(distmacapp)/Contents/Resources/icon.icns"

sed "s/{{app_version}}/$$RELEASE_NUMBER/" "build/distrib/darwin/Info.plist" > "$(distmacapp)/Contents/Info.plist"
chmod +x "$(distmacapp)/Contents/MacOS/launch-kosmorro"

# Clean package
rm "$(distmacapp)/Contents/MacOS/Pipfile" "$(distmacapp)/Contents/MacOS/Pipfile.lock"

@echo "Application created."
dist-mac-app:
python3 setup-gui-app.py py2app

distmacdmg = dist/Kosmorro.dmg
dist-mac-dmg: dist-mac-app


+ 0
- 22
build/distrib/darwin/Info.plist Переглянути файл

@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>Kosmorro</string>
<key>CFBundleExecutable</key>
<string>MacOS/launch-kosmorro</string>
<key>CFBundleIconFile</key>
<string>icon.icns</string>
<key>CFBundleIdentifier</key>
<string>space.kosmorro.app</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Kosmorro</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>{{app_version}}</string>
</dict>
</plist>

+ 0
- 7
build/distrib/darwin/launch-kosmorro.sh Переглянути файл

@@ -1,7 +0,0 @@
#!/bin/sh

# Move to the MacOS folder
cd $(dirname "$0")

source .venv/bin/activate
./python/bin/python3 kosmorro --gui

+ 11
- 0
kosmorro-gui Переглянути файл

@@ -0,0 +1,11 @@
#!/usr/bin/python3

from kosmorrolib.gui import mainwindow


def main():
mainwindow.start()


if __name__ == '__main__':
main()

+ 34
- 0
setup-gui-app.py Переглянути файл

@@ -0,0 +1,34 @@
#!/usr/bin/env python3

from setuptools import setup
from datetime import date

from kosmorrolib.version import VERSION


APP_DARWIN_IDENTIFIER = 'space.kosmorro.darwin'
EXECUTABLE_NAME = 'kosmorro'
APP_NAME = 'Kosmorro'
APP_COPYRIGHT = 'Jérôme Deuchnord © 2019-%d - GNU Affero General Public License' % date.today().year

APP = ['kosmorro-gui']
DATA_FILES = []
OPTIONS = {
'plist': {
'CFBundleName': APP_NAME,
'CFBundleDisplayName': APP_NAME,
'CFBundleExecutable': EXECUTABLE_NAME,
'CFBundleIdentifier': APP_DARWIN_IDENTIFIER,
'CFBundleShortVersionString': VERSION,
'NSHumanReadableCopyright': APP_COPYRIGHT
},
'iconfile': 'build/distrib/darwin/icon.icns',
'packages': ','.join(['wx'])
}

setup(
app=APP,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
)

Завантаження…
Відмінити
Зберегти