diff --git a/.appveyor.yml b/.appveyor.yml index 13952f800..821bbe7d3 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,5 +1,4 @@ environment: - global: # 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 @@ -8,76 +7,11 @@ environment: 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_VERSION: "3.6.x" PYTHON_ARCH: "32" - - #- PYTHON: "C:\\Python35-x64" - # 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" - +init: + - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) install: # 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 @@ -89,15 +23,6 @@ install: Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { ` 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:" - ps: "ls \"C:/\"" @@ -110,16 +35,11 @@ install: - ECHO "Installed SDKs:" - 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 # done from inside the powershell script as it would require to restart # the parent CMD process). - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" - # Check that we have the expected version and architecture for Python - "python --version" - "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, # pip will build them from source using the MSVC compiler matching the # target Python version and architecture - # C:\\projects\\eve-gnosis\\ - ECHO "Install pip requirements:" - "pip install -r requirements.txt" - "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 the compiled extension - # - "python setup.py build" - 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):" #- 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" @@ -155,12 +90,11 @@ build: on after_build: - ps: "ls \"./\"" #- 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\\\"" # Zip # APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER #- 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\*.* on_success: @@ -181,11 +115,21 @@ after_test: artifacts: # Archive the generated packages in the ci.appveyor.com build report. - - path: pyfa.zip - name: 'pyfa.zip' + - path: pyfa*-win.zip + - path: pyfa*-win.exe #- path: pyfa_debug.zip # 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: # - TODO: upload the content of dist/*.whl to a public wheelhouse # \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 889ad5544..9140c2f10 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,36 +1,29 @@ -dist: trusty -sudo: required +os: linux language: python -cache: pip python: - - '3.6' -env: - - TOXENV=pep8 -addons: - apt: - packages: + - 3.6 +matrix: + include: + - os: osx + osx_image: xcode7.3 + language: generic + env: PYTHON=3.6.1 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 - - pip install tox - # We're not actually installing Tox, but have to run it before we install wxPython via Conda. This is fugly but vOv - - tox - - pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk2/ubuntu-14.04 wxPython==4.0.0b2 -# # get Conda -# - if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then -# wget https://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh; -# else -# wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh; -# fi -# - bash miniconda.sh -b -p $HOME/miniconda -# - export PATH="$HOME/miniconda/bin:$PATH" -# - hash -r -# - conda config --set always_yes yes --set changeps1 no -# - conda update -q conda -# # Useful for debugging any issues with conda -# - conda info -a -#install: - # install wxPython 3.0.0.0 - # - conda install -c https://conda.anaconda.org/travis wxpython=4.0.0b2 -script: - - tox - + - bash scripts/setup-osx.sh +install: + - export PYFA_VERSION="$(python3 scripts/dump_version.py)" + - bash scripts/package-osx.sh +before_deploy: + - export RELEASE_PKG_FILE=$(ls *.deb) + - echo "deploying $RELEASE_PKG_FILE to GitHub releases" +deploy: + provider: releases + api_key: + secure: Xfu0xApoB0zUPLXl29aYUulVC3iA4/3bXQwwADKCfAKZwxgNon4dLbO7Rie5/7Ukf2POL0KwmRaQGN3kOr+XSoIVTE4M5sXxnhiaaLGKQ+48hDizLE6JuXcZGJvkxUaghaTzIdCwHsG7VGBsPfQgfGsjJcfBp8tFNLmRyM/Jpsr8T6BR2MxtBIEUVy8zrOWFNZqnmWrY2pWMsB9fYt3JFNdpqeIgRAYqbBsBcZQ1MngLTi3ztuYS5IaF+lk06RrnBlHmUsJu/5nCvIpvPvD0i2BLZ3Uu0+Fn+8QWUgjJEL9MNseXZMXynu05xd8YRk7Ajc9CUrzQIIbAktyteYp85kE3pUJHmrMLcXhh7nqkwttR5/47Zwa3OLJLJFKBxMx6wY5jFkJjkV08850B7aWrmTFl/Eqc3Q5nZMuiEt3wFRbjxHi9h1mTN/fkxfRRHg8u3ENGPR+ZPiFC3J18qtks/B/hsKjjHvZP1i79OYlET4V/zyLyyQkCbpDaARQANuotLYJyZ7tH+KWEyRsvTi0M9Yev9mNNw6aI4vzh4HfkEhvcvnWnYwckPj1dnjQ573Qpw0Z9wsconoWfHAn+hBDt3+YLMrrFZl++mCRskHH1mZChX3aGMDi49zD0kfxBUkYPOAhguc6PwudBxHUZP+O6T/SoHylff6EizCE/k5dGeAk= + file_glob: true + file: "dist/pyfa-*.zip" + skip_cleanup: true + draft: true + on: + tags: true + repo: pyfa-org/Pyfa diff --git a/config.py b/config.py index 4ba409e33..4e1234e90 100644 --- a/config.py +++ b/config.py @@ -1,5 +1,6 @@ import os import sys +import yaml from logbook import CRITICAL, DEBUG, ERROR, FingersCrossedHandler, INFO, Logger, NestedSetup, NullHandler, \ StreamHandler, TimedRotatingFileHandler, WARNING @@ -22,12 +23,6 @@ debug = False # Defines if our saveddata will be in pyfa root or not saveInRoot = False -# Version data - -version = "2.7.0" -tag = "Stable" -expansionName = "December" -expansionVersion = "1.0" evemonMinVersion = "4081" minItemSearchLength = 3 @@ -79,12 +74,7 @@ def getPyfaRoot(): def getVersion(): - if os.path.isfile(os.path.join(pyfaPath, '.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)" + return version def getDefaultSave(): @@ -96,11 +86,12 @@ def defPaths(customSavePath=None): global pyfaPath global savePath global saveDB - global gameDB + global gameDB global saveInRoot global logPath global cipher global clientHash + global version pyfalog.debug("Configuring Pyfa") @@ -110,6 +101,12 @@ def defPaths(customSavePath=None): if pyfaPath is None: 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 if saveInRoot is True: savePath = getattr(configforced, "savePath", None) diff --git a/dist_assets/mac/pyfa.spec b/dist_assets/mac/pyfa.spec index 8ce69749e..1e1f35711 100644 --- a/dist_assets/mac/pyfa.spec +++ b/dist_assets/mac/pyfa.spec @@ -24,9 +24,10 @@ added_files = [ ('../../eve.db', '.'), ('../../README.md', '.'), ('../../LICENSE', '.'), - ('../../.version', '.'), + ('../../version.yml', '.'), ] + import_these = [ '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_private_assemblies=False, cipher=block_cipher) + pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) + exe = EXE(pyz, a.scripts, a.binaries, @@ -71,10 +74,16 @@ exe = EXE(pyz, icon=icon, ) -app = BUNDLE(exe, - name='pyfa.app', - icon=icon, - bundle_identifier=None, - info_plist={ - 'NSHighResolutionCapable': 'True' - }) +app = BUNDLE( + exe, + name='pyfa.app', + icon=icon, + bundle_identifier=None, + info_plist={ + 'NSHighResolutionCapable': 'True', + 'NSPrincipalClass': 'NSApplication', + 'CFBundleName': 'pyfa', + 'CFBundleDisplayName': 'pyfa', + 'CFBundleIdentifier': 'org.pyfaorg.pyfa', + } +) \ No newline at end of file diff --git a/dist_assets/win/dist.py b/dist_assets/win/dist.py index ec6da3928..bff55018a 100644 --- a/dist_assets/win/dist.py +++ b/dist_assets/win/dist.py @@ -3,44 +3,35 @@ import os.path from subprocess import call import zipfile +from packaging.version import Version +import yaml -def zipdir(path, zip): - for root, dirs, files in os.walk(path): - for file in files: - zip.write(os.path.join(root, file)) +with open("version.yml", 'r') as file: + data = yaml.load(file) + version = data['version'] -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") - -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() +fileName = "pyfa-{}-win".format(os.environ["PYFA_VERSION"]) print("Compiling EXE") -expansion = "%s %s" % (config['expansionName'], config['expansionVersion']), +v = Version(version) + +print(v) call([ iscc, os.path.join(os.getcwd(), "dist_assets", "win", "pyfa-setup.iss"), - "/dMyAppVersion=%s" % (config['version']), - "/dMyAppExpansion=%s" % expansion, + "/dMyAppVersion=%s" % v, "/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 print("Done") diff --git a/dist_assets/win/pyfa-setup.iss b/dist_assets/win/pyfa-setup.iss index 7984da087..e016b3a37 100644 --- a/dist_assets/win/pyfa-setup.iss +++ b/dist_assets/win/pyfa-setup.iss @@ -7,15 +7,12 @@ #ifndef MyAppVersion #define MyAppVersion "2.1.0" #endif -#ifndef MyAppExpansion - #define MyAppExpansion "Vanguard 1.0" -#endif ; Other config #define MyAppName "pyfa" #define MyAppPublisher "pyfa" -#define MyAppURL "https://forums.eveonline.com/t/27156" +#define MyAppURL "https://github.com/pyfa-org/Pyfa/" #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 @@ -23,7 +20,7 @@ #define MinorVersionFlag 0 #ifndef MyOutputFile - #define MyOutputFile LowerCase(StringChange(MyAppName+'-'+MyAppVersion+'-'+MyAppExpansion+'-win-wx3', " ", "-")) + #define MyOutputFile LowerCase(StringChange(MyAppName+'-'+MyAppVersion+'-win', " ", "-")) #endif #ifndef MyAppDir #define MyAppDir "pyfa" @@ -39,7 +36,7 @@ ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) AppId={{3DA39096-C08D-49CD-90E0-1D177F32C8AA} AppName={#MyAppName} -AppVersion={#MyAppVersion} ({#MyAppExpansion}) +AppVersion={#MyAppVersion} AppPublisher={#MyAppPublisher} AppPublisherURL={#MyAppURL} AppSupportURL={#MyAppURL} @@ -51,10 +48,8 @@ LicenseFile={#MyAppDir}\LICENSE OutputDir={#MyOutputDir} OutputBaseFilename={#MyOutputFile} SetupIconFile={#MyAppDir}\pyfa.ico -Compression=lzma SolidCompression=yes CloseApplications=yes -AppReadmeFile=https://github.com/pyfa-org/Pyfa/blob/v{#MyAppVersion}/readme.txt [Languages] Name: "english"; MessagesFile: "compiler:Default.isl" diff --git a/dist_assets/win/pyfa.spec b/dist_assets/win/pyfa.spec index 992153b1c..1bdf820f0 100644 --- a/dist_assets/win/pyfa.spec +++ b/dist_assets/win/pyfa.spec @@ -5,8 +5,7 @@ from itertools import chain import subprocess import requests.certs -label = subprocess.check_output([ - "git", "describe", "--tags"]).strip() +label = subprocess.check_output(["git", "describe", "--tags"]).strip() with open('.version', 'w+') as f: f.write(label.decode()) @@ -18,7 +17,7 @@ added_files = [ ('../../imgs/gui/*.gif', 'imgs/gui'), ('../../imgs/icons/*.png', 'imgs/icons'), ('../../imgs/renders/*.png', 'imgs/renders'), - ('../../service/jargon/*.yaml', 'service/jargon'), + ('../../service/jargon/*.yaml', 'service/jargon'), ('../../dist_assets/win/pyfa.ico', '.'), ('../../dist_assets/win/pyfa.exe.manifest', '.'), ('../../dist_assets/win/Microsoft.VC90.CRT.manifest', '.'), @@ -26,7 +25,7 @@ added_files = [ ('../../eve.db', '.'), ('../../README.md', '.'), ('../../LICENSE', '.'), - ('../../.version', '.'), + ('../../version.yml', '.'), ] import_these = [ diff --git a/eos/effects/damagecontrol.py b/eos/effects/damagecontrol.py index 05589e15a..f563fac03 100644 --- a/eos/effects/damagecontrol.py +++ b/eos/effects/damagecontrol.py @@ -11,6 +11,5 @@ def handler(fit, module, context): bonus = "%s%sDamageResonance" % (attrPrefix, damageType) bonus = "%s%s" % (bonus[0].lower(), bonus[1:]) booster = "%s%sDamageResonance" % (layer, damageType) - penalize = False if layer == 'hull' else True fit.ship.multiplyItemAttr(bonus, module.getModifiedItemAttr(booster), - stackingPenalties=penalize, penaltyGroup="preMul") + stackingPenalties=True, penaltyGroup="preMul") diff --git a/eos/effects/emergencyhullenergizer.py b/eos/effects/emergencyhullenergizer.py index 8a281f74c..c2de4f4f5 100644 --- a/eos/effects/emergencyhullenergizer.py +++ b/eos/effects/emergencyhullenergizer.py @@ -8,4 +8,6 @@ runtime = "late" def handler(fit, src, context): for dmgType in ('em', 'thermal', 'kinetic', 'explosive'): - fit.ship.forceItemAttr('{}DamageResonance'.format(dmgType), src.getModifiedItemAttr("hull{}DamageResonance".format(dmgType.title()))) + fit.ship.multiplyItemAttr('{}DamageResonance'.format(dmgType), + src.getModifiedItemAttr("hull{}DamageResonance".format(dmgType.title())), + stackingPenalties=True, penaltyGroup="postMul") diff --git a/gui/aboutData.py b/gui/aboutData.py index 6e8ce07bc..2d658832f 100644 --- a/gui/aboutData.py +++ b/gui/aboutData.py @@ -19,7 +19,7 @@ import config -versionString = "{0} {1} - {2} {3}".format(config.version, config.tag, config.expansionName, config.expansionVersion) +versionString = "{0}".format(config.version) licenses = ( "pyfa is released under GNU GPLv3 - see included LICENSE file", "All EVE-Online related materials are property of CCP hf.", diff --git a/pyfa.spec b/pyfa.spec new file mode 100644 index 000000000..d3156bb80 --- /dev/null +++ b/pyfa.spec @@ -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 + ) diff --git a/requirements.txt b/requirements.txt index dc9c60768..0f75a043c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,11 +4,10 @@ matplotlib >= 2.0.0 python-dateutil requests >= 2.0.0 sqlalchemy == 1.0.5 -cryptography -diskcache -markdown2 -packaging -roman -beautifulsoup4 -PyYAML +cryptography ==2.2.2 +markdown2==2.3.5 +packaging==16.8 +roman==2.0.0 +beautifulsoup4==4.6.0 +PyYAML==3.12 PyInstaller == 3.3 \ No newline at end of file diff --git a/scripts/dump_version.py b/scripts/dump_version.py new file mode 100644 index 000000000..4b3a9583e --- /dev/null +++ b/scripts/dump_version.py @@ -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) + diff --git a/scripts/package-osx.sh b/scripts/package-osx.sh new file mode 100644 index 000000000..35a87a007 --- /dev/null +++ b/scripts/package-osx.sh @@ -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" \ No newline at end of file diff --git a/scripts/setup-osx.sh b/scripts/setup-osx.sh new file mode 100644 index 000000000..97d477b50 --- /dev/null +++ b/scripts/setup-osx.sh @@ -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 diff --git a/service/network.py b/service/network.py index 0c3bfb2b9..5554eadec 100644 --- a/service/network.py +++ b/service/network.py @@ -83,8 +83,7 @@ class Network(object): raise Error("Access not enabled - please enable in Preferences > Network") # Set up some things for the request - versionString = "{0} {1} - {2} {3}".format(config.version, config.tag, config.expansionName, - config.expansionVersion) + versionString = "{0}".format(config.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) diff --git a/service/port/efs.py b/service/port/efs.py index 51ff5c518..c93c7d87d 100755 --- a/service/port/efs.py +++ b/service/port/efs.py @@ -109,7 +109,7 @@ class EfsPort: "Burst Projectors", "Warp Disrupt Field Generator", "Armor Resistance Shift Hardener", "Target Breaker", "Micro Jump Drive", "Ship Modifiers", "Stasis Grappler", "Ancillary Remote Shield Booster", "Ancillary Remote Armor Repairer", - "Titan Phenomena Generator", "Non-Repeating Hardeners" + "Titan Phenomena Generator", "Non-Repeating Hardeners", "Mutadaptive Remote Armor Repairer" ] projectedMods = list(filter(lambda mod: mod.item and mod.item.group.name in modGroupNames, fit.modules)) # Sort projections to prevent the order needlessly changing as pyfa updates. @@ -145,7 +145,9 @@ class EfsPort: elif mod.item.group.name in ["Remote Shield Booster", "Ancillary Remote Shield Booster"]: stats["type"] = "Remote Shield Booster" EfsPort.attrDirectMap(["shieldBonus"], stats, mod) - elif mod.item.group.name in ["Remote Armor Repairer", "Ancillary Remote Armor Repairer"]: + elif mod.item.group.name in [ + "Remote Armor Repairer", "Ancillary Remote Armor Repairer", "Mutadaptive Remote Armor Repairer" + ]: stats["type"] = "Remote Armor Repairer" EfsPort.attrDirectMap(["armorDamageAmount"], stats, mod) elif mod.item.group.name == "Warp Scrambler": diff --git a/version.yml b/version.yml new file mode 100644 index 000000000..e35fb355c --- /dev/null +++ b/version.yml @@ -0,0 +1 @@ +version: v2.7.5