Merge pull request #1853 from blitzmann/CIUpdates

CI updates
This commit is contained in:
Ryan Holmes
2019-02-17 16:19:16 -05:00
committed by GitHub
15 changed files with 283 additions and 195 deletions

View File

@@ -1,5 +1,4 @@
environment: environment:
global: global:
# SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the # SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the
# /E:ON and /V:ON options are not enabled in the batch script intepreter # /E:ON and /V:ON options are not enabled in the batch script intepreter
@@ -8,76 +7,11 @@ environment:
matrix: matrix:
# Python 2.7.10 is the latest version and is not pre-installed.
# - PYTHON: "C:\\Python27.10"
# PYTHON_VERSION: "2.7.10"
# PYTHON_ARCH: "32"
#- PYTHON: "C:\\Python27.10-x64"
# PYTHON_VERSION: "2.7.10"
# PYTHON_ARCH: "64"
# Pre-installed Python versions, which Appveyor may upgrade to
# a later point release.
# See: http://www.appveyor.com/docs/installed-software#python
#- PYTHON: "C:\\Python27"
# PYTHON_VERSION: "2.7.x" # currently 2.7.9
# PYTHON_ARCH: "32"
#- PYTHON: "C:\\Python27-x64"
# PYTHON_VERSION: "2.7.x" # currently 2.7.9
# PYTHON_ARCH: "64"
#- PYTHON: "C:\\Python33"
# PYTHON_VERSION: "3.3.x" # currently 3.3.5
# PYTHON_ARCH: "32"
#- PYTHON: "C:\\Python33-x64"
# PYTHON_VERSION: "3.3.x" # currently 3.3.5
# PYTHON_ARCH: "64"
#- PYTHON: "C:\\Python34"
# PYTHON_VERSION: "3.4.x" # currently 3.4.3
# PYTHON_ARCH: "32"
#- PYTHON: "C:\\Python34-x64"
# PYTHON_VERSION: "3.4.x" # currently 3.4.3
# PYTHON_ARCH: "64"
# Python versions not pre-installed
# Python 2.6.6 is the latest Python 2.6 with a Windows installer
# See: https://github.com/ogrisel/python-appveyor-demo/issues/10
#- PYTHON: "C:\\Python266"
# PYTHON_VERSION: "2.6.6"
# PYTHON_ARCH: "32"
#- PYTHON: "C:\\Python266-x64"
# PYTHON_VERSION: "2.6.6"
# PYTHON_ARCH: "64"
- PYTHON: "C:\\Python36" - PYTHON: "C:\\Python36"
PYTHON_VERSION: "3.6.x" PYTHON_VERSION: "3.6.x"
PYTHON_ARCH: "32" PYTHON_ARCH: "32"
init:
#- PYTHON: "C:\\Python35-x64" - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
# PYTHON_VERSION: "3.5.0"
# PYTHON_ARCH: "64"
# Major and minor releases (i.e x.0.0 and x.y.0) prior to 3.3.0 use
# a different naming scheme.
#- PYTHON: "C:\\Python270"
# PYTHON_VERSION: "2.7.0"
# PYTHON_ARCH: "32"
#- PYTHON: "C:\\Python270-x64"
# PYTHON_VERSION: "2.7.0"
# PYTHON_ARCH: "64"
install: install:
# If there is a newer build queued for the same PR, cancel this one. # If there is a newer build queued for the same PR, cancel this one.
# The AppVeyor 'rollout builds' option is supposed to serve the same # The AppVeyor 'rollout builds' option is supposed to serve the same
@@ -89,15 +23,6 @@ install:
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { ` Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
throw "There are newer queued builds for this pull request, failing early." } throw "There are newer queued builds for this pull request, failing early." }
# # Install wxPython
# - 'ECHO Downloading wxPython.'
# - "appveyor DownloadFile https://goo.gl/yvO8PB -FileName C:\\wxpython.exe"
# #- "appveyor DownloadFile https://goo.gl/Uj0jV3 -FileName C:\\wxpython64.exe"
#
# - 'ECHO Install wxPython'
# - "C:\\wxpython.exe /SP- /VERYSILENT /NORESTART"
# #- "C:\\wxpython64.exe /SP- /VERYSILENT /NORESTART"
- ECHO "Filesystem root:" - ECHO "Filesystem root:"
- ps: "ls \"C:/\"" - ps: "ls \"C:/\""
@@ -110,16 +35,11 @@ install:
- ECHO "Installed SDKs:" - ECHO "Installed SDKs:"
- ps: "ls \"C:/Program Files/Microsoft SDKs/Windows\"" - ps: "ls \"C:/Program Files/Microsoft SDKs/Windows\""
# Install Python (from the official .msi of http://python.org) and pip when
# not already installed.
# - ps: if (-not(Test-Path($env:PYTHON))) { & appveyor\install.ps1 }
# Prepend newly installed Python to the PATH of this build (this cannot be # Prepend newly installed Python to the PATH of this build (this cannot be
# done from inside the powershell script as it would require to restart # done from inside the powershell script as it would require to restart
# the parent CMD process). # the parent CMD process).
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
# Check that we have the expected version and architecture for Python
- "python --version" - "python --version"
- "python -c \"import struct; print(struct.calcsize('P') * 8)\"" - "python -c \"import struct; print(struct.calcsize('P') * 8)\""
@@ -131,21 +51,36 @@ install:
# compiled extensions and are not provided as pre-built wheel packages, # compiled extensions and are not provided as pre-built wheel packages,
# pip will build them from source using the MSVC compiler matching the # pip will build them from source using the MSVC compiler matching the
# target Python version and architecture # target Python version and architecture
# C:\\projects\\eve-gnosis\\
- ECHO "Install pip requirements:" - ECHO "Install pip requirements:"
- "pip install -r requirements.txt" - "pip install -r requirements.txt"
- "pip install PyInstaller" - "pip install PyInstaller"
# - "pip install -r requirements_test.txt"
# - "pip install -r requirements_build_windows.txt" before_build:
# directory that will contain the built files
- ps: $env:PYFA_DIST_DIR = "c:\projects\$env:APPVEYOR_PROJECT_SLUG\dist"
- ps: $env:PYFA_VERSION = (python ./scripts/dump_version.py)
- ps: echo("pyfa version ")
- ps: echo ($env:PYFA_VERSION)
build_script: build_script:
# Build the compiled extension
# - "python setup.py build"
- ECHO "Build pyfa:" - ECHO "Build pyfa:"
#- copy C:\projects\pyfa\dist_assets\win\pyfa.spec C:\projects\pyfa\pyfa.spec
- ps: cd C:\projects\$env:APPVEYOR_PROJECT_SLUG
- "python -m PyInstaller --noupx --clean --windowed --noconsole -m ./dist_assets/win/pyfa.exe.manifest -y ./dist_assets/win/pyfa.spec"
##########
# PyInstaller - create binaries for pyfa
##########
# Build command for PyInstaller
- "python -m PyInstaller --noupx --clean --windowed --noconsole -y pyfa.spec"
# Copy over manifest (See pyfa-org/pyfa#1622)
- ps: xcopy /y dist_assets\win\pyfa.exe.manifest $env:PYFA_DIST_DIR\pyfa\
# Not really sure if this is needed, but why not
- ps: xcopy /y dist_assets\win\Microsoft.VC90.CRT.manifest $env:PYFA_DIST_DIR\pyfa\
##########
# InnoScript EXE building
# This is in a separate script because I don't feel like copying over the logic to AppVeyor script right now...
##########
- "python dist_assets/win/dist.py"
- ps: dir $env:PYFA_DIST_DIR/
#- ECHO "Build pyfa (Debug):" #- ECHO "Build pyfa (Debug):"
#- copy C:\projects\pyfa\dist_assets\win\pyfa_debug.spec C:\projects\pyfa\pyfa_debug.spec #- copy C:\projects\pyfa\dist_assets\win\pyfa_debug.spec C:\projects\pyfa\pyfa_debug.spec
#- "pyinstaller.exe --clean --noconfirm --windowed --upx-dir=C:\\projects\\pyfa\\scripts\\upx.exe C:\\projects\\pyfa\\pyfa_debug.spec" #- "pyinstaller.exe --clean --noconfirm --windowed --upx-dir=C:\\projects\\pyfa\\scripts\\upx.exe C:\\projects\\pyfa\\pyfa_debug.spec"
@@ -155,12 +90,11 @@ build: on
after_build: after_build:
- ps: "ls \"./\"" - ps: "ls \"./\""
#- ps: "ls \"C:\\projects\\pyfa\\build\\pyfa\\\"" #- ps: "ls \"C:\\projects\\pyfa\\build\\pyfa\\\""
- ps: "ls \"C:\\projects\\$env:APPVEYOR_PROJECT_SLUG\\dist\\\""
# - ps: "ls \"C:\\projects\\$env:APPVEYOR_PROJECT_SLUG\\build\\exe.win32-2.7\\\"" # - ps: "ls \"C:\\projects\\$env:APPVEYOR_PROJECT_SLUG\\build\\exe.win32-2.7\\\""
# Zip # Zip
# APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER # APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER
#- 7z a build.zip -r C:\projects\pyfa\build\pyfa\*.* #- 7z a build.zip -r C:\projects\pyfa\build\pyfa\*.*
- ps: 7z a pyfa.zip -r C:\projects\$env:APPVEYOR_PROJECT_SLUG\dist\pyfa\*.* - ps: 7z a "pyfa-$env:PYFA_VERSION-win.zip" -r "$env:PYFA_DIST_DIR\pyfa\*.*"
#- 7z a pyfa_debug.zip -r C:\projects\pyfa\dist\pyfa_debug\*.* #- 7z a pyfa_debug.zip -r C:\projects\pyfa\dist\pyfa_debug\*.*
on_success: on_success:
@@ -181,11 +115,21 @@ after_test:
artifacts: artifacts:
# Archive the generated packages in the ci.appveyor.com build report. # Archive the generated packages in the ci.appveyor.com build report.
- path: pyfa.zip - path: pyfa*-win.zip
name: 'pyfa.zip' - path: pyfa*-win.exe
#- path: pyfa_debug.zip #- path: pyfa_debug.zip
# name: Pyfa_debug # name: Pyfa_debug
deploy:
tag: $(pyfa_version)
release: pyfa $(pyfa_version)
description: 'Release description'
provider: GitHub
auth_token:
secure: BfNHO66ff5hVx2O2ORbl49X0U/5h2V2T0IuRZDwm7fd1HvsVluF0wRCbl29oRp1M
draft: true
on:
APPVEYOR_REPO_TAG: true # deploy on tag push only
#on_success: #on_success:
# - TODO: upload the content of dist/*.whl to a public wheelhouse # - TODO: upload the content of dist/*.whl to a public wheelhouse
# #

View File

@@ -1,36 +1,28 @@
dist: trusty os: linux
sudo: required
language: python language: python
cache: pip
python: python:
- '3.6' - 3.6
env: matrix:
- TOXENV=pep8 include:
addons: - os: osx
apt: osx_image: xcode7.3
packages: language: generic
env: PYTHON=3.6.1
before_install: before_install:
- sudo apt-get update && sudo apt-get --reinstall install -qq language-pack-en language-pack-ru language-pack-he language-pack-zh-hans - bash scripts/setup-osx.sh
- pip install tox install:
# We're not actually installing Tox, but have to run it before we install wxPython via Conda. This is fugly but vOv - export PYFA_VERSION="$(python3 scripts/dump_version.py)"
- tox - bash scripts/package-osx.sh
- pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk2/ubuntu-14.04 wxPython==4.0.0b2 before_deploy:
# # get Conda - export RELEASE_PKG_FILE=$(ls *.deb)
# - if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then - echo "deploying $RELEASE_PKG_FILE to GitHub releases"
# wget https://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh; deploy:
# else provider: releases
# wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh; api_key:
# fi secure: hBxkenj8FCtM7O5qw/ikdp1rErJiqp/3A/fY8Y273TNVii+y+EEqcwERcUz3fOYj0CuxquU/1aeKMlTfypEPU6fGt0FMlgRDul61yZrs0Dnig4ZwjgQ0SAE6Y+RjztCLp3IzxZXXMxSfRpyKVsc3Nfv3K97ReNkzrj3cKtSpDF9xhW7MV7MOjK8vzol/aGDA2YmHPR7dFJotSebAXQWBrxAgWOWgmaZL0dFtLgrjVUOcM4o2XWNDmByJr9q86r9qIPkPp8M7dRCBzAYkWnAEqfj8h2W9Bp5p/HWhmznO5Ph5/wzEvPpG2YLofgoyRopdBX21eikfA9bI/fCH/ii+eyX8ainZWFfZiDPVH6IXCNfBd+ux6/a8Cq/rcaZ2a9/1MTTMtZqQ5PcMDaoaeghDjHx8H/QWguPTSZMxZ5FCeKpoYJad7/J3a/w4MVb6bdwB23pnXol//vlQd66FXy80SeP3tc0NIdpN3pS/UtDTn5cAqKn2XNWMkQfOZi8GC5tFnEkWRCob+OLN/sJOJxtPrqCEB29W/t/BfjhHyQznKQt3hWZYms1103naj4BBAFWi2rp83ZptkAxS6MlRPi7AkDjIisUlZfJ6ppsxB+fbayAJOxqPnbWgZ/xDRx6ihTRZZR1X9g9OMBtpRdV6yT+XQvE1eGSp4kjgvESiqT/EyHY=
# - bash miniconda.sh -b -p $HOME/miniconda file_glob: true
# - export PATH="$HOME/miniconda/bin:$PATH" file: "dist/pyfa-*.zip"
# - hash -r skip_cleanup: true
# - conda config --set always_yes yes --set changeps1 no draft: true
# - conda update -q conda on:
# # Useful for debugging any issues with conda tags: true
# - conda info -a
#install:
# install wxPython 3.0.0.0
# - conda install -c https://conda.anaconda.org/travis wxpython=4.0.0b2
script:
- tox

View File

@@ -1,5 +1,6 @@
import os import os
import sys import sys
import yaml
from logbook import CRITICAL, DEBUG, ERROR, FingersCrossedHandler, INFO, Logger, NestedSetup, NullHandler, \ from logbook import CRITICAL, DEBUG, ERROR, FingersCrossedHandler, INFO, Logger, NestedSetup, NullHandler, \
StreamHandler, TimedRotatingFileHandler, WARNING StreamHandler, TimedRotatingFileHandler, WARNING
@@ -22,12 +23,6 @@ debug = False
# Defines if our saveddata will be in pyfa root or not # Defines if our saveddata will be in pyfa root or not
saveInRoot = False saveInRoot = False
# Version data
version = "2.7.0"
tag = "Stable"
expansionName = "December"
expansionVersion = "1.0"
evemonMinVersion = "4081" evemonMinVersion = "4081"
minItemSearchLength = 3 minItemSearchLength = 3
@@ -79,12 +74,7 @@ def getPyfaRoot():
def getVersion(): def getVersion():
if os.path.isfile(os.path.join(pyfaPath, '.version')): return version
with open(os.path.join(pyfaPath, '.version')) as f:
gitVersion = f.readline()
return gitVersion
# if no version file exists, then user is running from source or not an official build
return version + " (git)"
def getDefaultSave(): def getDefaultSave():
@@ -96,11 +86,12 @@ def defPaths(customSavePath=None):
global pyfaPath global pyfaPath
global savePath global savePath
global saveDB global saveDB
global gameDB global gameDB
global saveInRoot global saveInRoot
global logPath global logPath
global cipher global cipher
global clientHash global clientHash
global version
pyfalog.debug("Configuring Pyfa") pyfalog.debug("Configuring Pyfa")
@@ -110,6 +101,12 @@ def defPaths(customSavePath=None):
if pyfaPath is None: if pyfaPath is None:
pyfaPath = getPyfaRoot() pyfaPath = getPyfaRoot()
# Version data
with open(os.path.join(pyfaPath, "version.yml"), 'r') as file:
data = yaml.load(file)
version = data['version']
# Where we store the saved fits etc, default is the current users home directory # Where we store the saved fits etc, default is the current users home directory
if saveInRoot is True: if saveInRoot is True:
savePath = getattr(configforced, "savePath", None) savePath = getattr(configforced, "savePath", None)

View File

@@ -24,9 +24,10 @@ added_files = [
('../../eve.db', '.'), ('../../eve.db', '.'),
('../../README.md', '.'), ('../../README.md', '.'),
('../../LICENSE', '.'), ('../../LICENSE', '.'),
('../../.version', '.'), ('../../version.yml', '.'),
] ]
import_these = [ import_these = [
'numpy.core._dtype_ctypes' # https://github.com/pyinstaller/pyinstaller/issues/3982 'numpy.core._dtype_ctypes' # https://github.com/pyinstaller/pyinstaller/issues/3982
] ]
@@ -55,8 +56,10 @@ a = Analysis([r'../../pyfa.py'],
win_no_prefer_redirects=False, win_no_prefer_redirects=False,
win_private_assemblies=False, win_private_assemblies=False,
cipher=block_cipher) cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data, pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher) cipher=block_cipher)
exe = EXE(pyz, exe = EXE(pyz,
a.scripts, a.scripts,
a.binaries, a.binaries,
@@ -71,10 +74,16 @@ exe = EXE(pyz,
icon=icon, icon=icon,
) )
app = BUNDLE(exe, app = BUNDLE(
name='pyfa.app', exe,
icon=icon, name='pyfa.app',
bundle_identifier=None, icon=icon,
info_plist={ bundle_identifier=None,
'NSHighResolutionCapable': 'True' info_plist={
}) 'NSHighResolutionCapable': 'True',
'NSPrincipalClass': 'NSApplication',
'CFBundleName': 'pyfa',
'CFBundleDisplayName': 'pyfa',
'CFBundleIdentifier': 'org.pyfaorg.pyfa',
}
)

View File

@@ -3,44 +3,35 @@
import os.path import os.path
from subprocess import call from subprocess import call
import zipfile import zipfile
from packaging.version import Version
import yaml
def zipdir(path, zip): with open("version.yml", 'r') as file:
for root, dirs, files in os.walk(path): data = yaml.load(file)
for file in files: version = data['version']
zip.write(os.path.join(root, file))
config = {} os.environ["PYFA_DIST_DIR"] = os.path.join(os.getcwd(), 'dist')
exec(compile(open("config.py").read(), "config.py", 'exec'), config) os.environ["PYFA_VERSION"] = version
iscc = "C:\Program Files (x86)\Inno Setup 5\ISCC.exe" # inno script location via wine
iscc = "C:\Program Files (x86)\Inno Setup 5\ISCC.exe" # inno script location via wine source = os.path.join(os.environ["PYFA_DIST_DIR"], "pyfa")
print("Creating archive") fileName = "pyfa-{}-win".format(os.environ["PYFA_VERSION"])
source = os.path.join(os.getcwd(), "dist", "pyfa")
fileName = "pyfa-{}-{}-{}-win".format(
config['version'],
config['expansionName'].lower(),
config['expansionVersion']
)
archive = zipfile.ZipFile(os.path.join(os.getcwd(), "dist", fileName + ".zip"), 'w', compression=zipfile.ZIP_DEFLATED)
zipdir(source, archive)
archive.close()
print("Compiling EXE") print("Compiling EXE")
expansion = "%s %s" % (config['expansionName'], config['expansionVersion']), v = Version(version)
print(v)
call([ call([
iscc, iscc,
os.path.join(os.getcwd(), "dist_assets", "win", "pyfa-setup.iss"), os.path.join(os.getcwd(), "dist_assets", "win", "pyfa-setup.iss"),
"/dMyAppVersion=%s" % (config['version']), "/dMyAppVersion=%s" % v,
"/dMyAppExpansion=%s" % expansion,
"/dMyAppDir=%s" % source, "/dMyAppDir=%s" % source,
"/dMyOutputDir=%s" % os.path.join(os.getcwd(), "dist"), "/dMyOutputDir=%s" % os.path.join(os.getcwd()),
"/dMyOutputFile=%s" % fileName]) # stdout=devnull, stderr=devnull "/dMyOutputFile=%s" % fileName]) # stdout=devnull, stderr=devnull
print("Done") print("Done")

View File

@@ -7,15 +7,12 @@
#ifndef MyAppVersion #ifndef MyAppVersion
#define MyAppVersion "2.1.0" #define MyAppVersion "2.1.0"
#endif #endif
#ifndef MyAppExpansion
#define MyAppExpansion "Vanguard 1.0"
#endif
; Other config ; Other config
#define MyAppName "pyfa" #define MyAppName "pyfa"
#define MyAppPublisher "pyfa" #define MyAppPublisher "pyfa"
#define MyAppURL "https://forums.eveonline.com/t/27156" #define MyAppURL "https://github.com/pyfa-org/Pyfa/"
#define MyAppExeName "pyfa.exe" #define MyAppExeName "pyfa.exe"
; What version starts with the new structure (1.x.0). This is used to determine if we run directory structure cleanup ; What version starts with the new structure (1.x.0). This is used to determine if we run directory structure cleanup
@@ -23,7 +20,7 @@
#define MinorVersionFlag 0 #define MinorVersionFlag 0
#ifndef MyOutputFile #ifndef MyOutputFile
#define MyOutputFile LowerCase(StringChange(MyAppName+'-'+MyAppVersion+'-'+MyAppExpansion+'-win-wx3', " ", "-")) #define MyOutputFile LowerCase(StringChange(MyAppName+'-'+MyAppVersion+'-win', " ", "-"))
#endif #endif
#ifndef MyAppDir #ifndef MyAppDir
#define MyAppDir "pyfa" #define MyAppDir "pyfa"
@@ -39,7 +36,7 @@
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{3DA39096-C08D-49CD-90E0-1D177F32C8AA} AppId={{3DA39096-C08D-49CD-90E0-1D177F32C8AA}
AppName={#MyAppName} AppName={#MyAppName}
AppVersion={#MyAppVersion} ({#MyAppExpansion}) AppVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher} AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL} AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL} AppSupportURL={#MyAppURL}
@@ -51,10 +48,8 @@ LicenseFile={#MyAppDir}\LICENSE
OutputDir={#MyOutputDir} OutputDir={#MyOutputDir}
OutputBaseFilename={#MyOutputFile} OutputBaseFilename={#MyOutputFile}
SetupIconFile={#MyAppDir}\pyfa.ico SetupIconFile={#MyAppDir}\pyfa.ico
Compression=lzma
SolidCompression=yes SolidCompression=yes
CloseApplications=yes CloseApplications=yes
AppReadmeFile=https://github.com/pyfa-org/Pyfa/blob/v{#MyAppVersion}/readme.txt
[Languages] [Languages]
Name: "english"; MessagesFile: "compiler:Default.isl" Name: "english"; MessagesFile: "compiler:Default.isl"

View File

@@ -5,8 +5,7 @@ from itertools import chain
import subprocess import subprocess
import requests.certs import requests.certs
label = subprocess.check_output([ label = subprocess.check_output(["git", "describe", "--tags"]).strip()
"git", "describe", "--tags"]).strip()
with open('.version', 'w+') as f: with open('.version', 'w+') as f:
f.write(label.decode()) f.write(label.decode())
@@ -18,7 +17,7 @@ added_files = [
('../../imgs/gui/*.gif', 'imgs/gui'), ('../../imgs/gui/*.gif', 'imgs/gui'),
('../../imgs/icons/*.png', 'imgs/icons'), ('../../imgs/icons/*.png', 'imgs/icons'),
('../../imgs/renders/*.png', 'imgs/renders'), ('../../imgs/renders/*.png', 'imgs/renders'),
('../../service/jargon/*.yaml', 'service/jargon'), ('../../service/jargon/*.yaml', 'service/jargon'),
('../../dist_assets/win/pyfa.ico', '.'), ('../../dist_assets/win/pyfa.ico', '.'),
('../../dist_assets/win/pyfa.exe.manifest', '.'), ('../../dist_assets/win/pyfa.exe.manifest', '.'),
('../../dist_assets/win/Microsoft.VC90.CRT.manifest', '.'), ('../../dist_assets/win/Microsoft.VC90.CRT.manifest', '.'),
@@ -26,7 +25,7 @@ added_files = [
('../../eve.db', '.'), ('../../eve.db', '.'),
('../../README.md', '.'), ('../../README.md', '.'),
('../../LICENSE', '.'), ('../../LICENSE', '.'),
('../../.version', '.'), ('../../version.yml', '.'),
] ]
import_these = [ import_these = [

View File

@@ -19,7 +19,7 @@
import config import config
versionString = "{0} {1} - {2} {3}".format(config.version, config.tag, config.expansionName, config.expansionVersion) versionString = "{0}".format(config.version)
licenses = ( licenses = (
"pyfa is released under GNU GPLv3 - see included LICENSE file", "pyfa is released under GNU GPLv3 - see included LICENSE file",
"All EVE-Online related materials are property of CCP hf.", "All EVE-Online related materials are property of CCP hf.",

121
pyfa.spec Normal file
View File

@@ -0,0 +1,121 @@
# -*- mode: python -*-
import os
from itertools import chain
import subprocess
import requests.certs
import platform
os_name = platform.system()
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'),
('service/jargon/*.yaml', 'service/jargon'),
(requests.certs.where(), '.'), # is this needed anymore?
('eve.db', '.'),
('README.md', '.'),
('LICENSE', '.'),
('version.yml', '.'),
]
icon = None
pathex = []
upx = True
debug = False
if os_name == 'Windows':
added_files.extend([
('dist_assets/win/pyfa.ico', '.'),
('dist_assets/win/pyfa.exe.manifest', '.'),
('dist_assets/win/Microsoft.VC90.CRT.manifest', '.')
])
icon = 'dist_assets/win/pyfa.ico'
pathex.extend([
# Need this, see https://github.com/pyinstaller/pyinstaller/issues/1566
# To get this, download and install windows 10 SDK
# If not building on Windows 10, this might be optional
r'C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86'
])
if os_name == 'Darwin':
added_files.extend([
('dist_assets/win/pyfa.ico', '.'), # osx only
])
icon = 'dist_assets/mac/pyfa.icns'
import_these = [
'numpy.core._dtype_ctypes' # https://github.com/pyinstaller/pyinstaller/issues/3982
]
# 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= pathex,
binaries=[],
datas=added_files,
hiddenimports=import_these,
hookspath=['dist_assets/pyinstaller_hooks'],
runtime_hooks=[],
excludes=['Tkinter'],
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=debug,
strip=False,
upx=upx,
icon= icon,
# version='win-version-info.txt',
console=False
)
coll = COLLECT(
exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=upx,
name='pyfa',
)
if platform.system() == 'Darwin':
info_plist = {
'NSHighResolutionCapable': 'True',
'NSPrincipalClass': 'NSApplication',
'CFBundleName': 'pyfa',
'CFBundleDisplayName': 'pyfa',
'CFBundleIdentifier': 'org.pyfaorg.pyfa',
'CFBundleVersion': '1.2.3',
'CFBundleShortVersionString': '1.2.3',
}
app = BUNDLE(exe,
name='pyfa.app',
icon=icon,
bundle_identifier=None,
info_plist=info_plist
)

View File

@@ -4,11 +4,10 @@ matplotlib >= 2.0.0
python-dateutil python-dateutil
requests >= 2.0.0 requests >= 2.0.0
sqlalchemy == 1.0.5 sqlalchemy == 1.0.5
cryptography cryptography ==2.2.2
diskcache markdown2==2.3.5
markdown2 packaging==16.8
packaging roman==2.0.0
roman beautifulsoup4==4.6.0
beautifulsoup4 PyYAML==3.12
PyYAML
PyInstaller == 3.3 PyInstaller == 3.3

23
scripts/dump_version.py Normal file
View File

@@ -0,0 +1,23 @@
"""
This script is solely used when generating builds. It generates a version number automatically using
git tags as it's basis. Whenever a build is created, run this file beforehand and it should replace
the old version number with the new one in VERSION.YML
"""
import yaml
import subprocess
import os
with open("version.yml", 'r+') as file:
data = yaml.load(file)
file.seek(0)
file.truncate()
# todo: run Version() on the tag to ensure that it's of proper formatting - fail a test if not and prevent building
# python's versioning spec doesn't handle the same format git describe outputs, so convert it.
label = os.environ["PYFA_VERSION"].split('-') if "PYFA_VERSION" in os.environ else subprocess.check_output(["git", "describe", "--tags"]).strip().decode().split('-')
label = '-'.join(label[:-2])+'+'+'-'.join(label[-2:]) if len(label) > 1 else label[0]
print(label)
data['version'] = label
yaml.dump(data, file, default_flow_style=False)

11
scripts/package-osx.sh Normal file
View File

@@ -0,0 +1,11 @@
#!/usr/bin/env bash
echo "${PYFA_VERSION}"
cat version.yml
python3 -m PyInstaller -y --clean --windowed dist_assets/mac/pyfa.spec
cd dist
zip -r "pyfa-$PYFA_VERSION-mac.zip" pyfa.app
curl --upload-file "pyfa-$PYFA_VERSION-mac.zip" https://transfer.sh/
echo -e "\n"
md5 -r "pyfa-$PYFA_VERSION-mac.zip"

7
scripts/setup-osx.sh Normal file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
wget "https://www.python.org/ftp/python/${PYTHON}/python-${PYTHON}-macosx10.6.pkg"
sudo installer -pkg python-${PYTHON}-macosx10.6.pkg -target /
sudo python3 -m ensurepip
# A manual check that the correct version of Python is running.
python3 --version
pip3 install -r requirements.txt

View File

@@ -83,8 +83,7 @@ class Network(object):
raise Error("Access not enabled - please enable in Preferences > Network") raise Error("Access not enabled - please enable in Preferences > Network")
# Set up some things for the request # Set up some things for the request
versionString = "{0} {1} - {2} {3}".format(config.version, config.tag, config.expansionName, versionString = "{0}".format(config.version)
config.expansionVersion)
headers = {"User-Agent": "pyfa {0} (python-requests {1})".format(versionString, requests.__version__)} headers = {"User-Agent": "pyfa {0} (python-requests {1})".format(versionString, requests.__version__)}
# user-agent: pyfa 2.0.0b4 git -YC120.2 1.2 (python-requests 2.18.4) # user-agent: pyfa 2.0.0b4 git -YC120.2 1.2 (python-requests 2.18.4)

1
version.yml Normal file
View File

@@ -0,0 +1 @@
version: v2.7.5