Fix a bug in the *.spec files and also apply the following major changes:
- Add support for adding the base folder to PATH. - Only display one pop up window at a time in order to avoid confusion. - Add automatic updates feature: - Windows and Linux versions will be shipped with an updater program used to update both Artemis and the updater itself. - MacOs versions will not have the updater. Instead the user will be asked to download the new software version (if present) via browser.
This commit is contained in:
@@ -11,8 +11,9 @@ SRC_PATH = "../../src/"
|
||||
|
||||
data_file = [
|
||||
(f, '.') for f in glob.glob(SRC_PATH + '*.[pu][yi]')
|
||||
if f.split('/')[-1] != "artemis.py"
|
||||
].append((SRC_PATH + 'cacert.pem', '.'))
|
||||
if f.split('/')[-1] != "artemis.py" and f.split('/')[-1] != "updater.py"
|
||||
]
|
||||
data_file.append((SRC_PATH + 'cacert.pem', '.'))
|
||||
|
||||
a = Analysis([SRC_PATH + 'artemis.py'], # noqa: 821
|
||||
pathex=[os.getcwd()],
|
||||
|
||||
@@ -12,7 +12,8 @@ SRC_PATH = "../../src/"
|
||||
data_file = [
|
||||
(f, '.') for f in glob.glob(SRC_PATH + '*.[pu][yi]')
|
||||
if f.split('/')[-1] != "artemis.py"
|
||||
].append((SRC_PATH + 'cacert.pem', '.'))
|
||||
]
|
||||
data_file.append((SRC_PATH + 'cacert.pem', '.'))
|
||||
|
||||
a = Analysis([SRC_PATH + 'artemis.py'], # noqa: 821
|
||||
pathex=[os.getcwd()],
|
||||
|
||||
42
spec_files/Linux/build.sh
Normal file
42
spec_files/Linux/build.sh
Normal file
@@ -0,0 +1,42 @@
|
||||
echo "Build Artemis executable.."
|
||||
|
||||
rm -rf output
|
||||
|
||||
mkdir output
|
||||
mkdir output/artemis
|
||||
|
||||
pyinstaller Artemis.spec
|
||||
|
||||
mv -v ./dist/Artemis ./output/Artemis
|
||||
rm -rfv dist build
|
||||
|
||||
echo "Build _ArtemisUpdater.."
|
||||
|
||||
pyinstaller updater.spec
|
||||
|
||||
mv -v ./dist/_ArtemisUpdater ./output/_ArtemisUpdater
|
||||
rm -rfv dist build
|
||||
|
||||
echo "Create single archives"
|
||||
cd output
|
||||
|
||||
cp -r ../../../src/themes artemis/themes
|
||||
rm -f artemis/themes/__current_theme
|
||||
cp Artemis artemis/Artemis
|
||||
cp _ArtemisUpdater artemis/_ArtemisUpdater
|
||||
|
||||
tar -czvf Artemis_linux.tar.gz Artemis -C artemis themes
|
||||
tar -czvf _ArtemisUpdater_linux.tar.gz ./_ArtemisUpdater
|
||||
|
||||
echo "Create full archive for website"
|
||||
|
||||
cp ../artemis3.svg artemis
|
||||
cp ../create_shortcut.sh artemis
|
||||
|
||||
tar -czvf ArtemisWebDownlaod_linux.tar.gz artemis
|
||||
|
||||
echo "Get size and sha256"
|
||||
python ../../__get_hash_code.py Artemis_linux.tar.gz _ArtemisUpdater_linux.tar.gz ArtemisWebDownlaod_linux.tar.gz
|
||||
|
||||
cd ..
|
||||
echo "Done."
|
||||
51
spec_files/Linux/updater.spec
Normal file
51
spec_files/Linux/updater.spec
Normal file
@@ -0,0 +1,51 @@
|
||||
# -*- mode: python ; coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
|
||||
|
||||
BASE_FOLDER = "../../src/"
|
||||
block_cipher = None
|
||||
|
||||
data_file = [
|
||||
(os.path.join(BASE_FOLDER, "download_db_window.ui"), "."),
|
||||
(os.path.join(BASE_FOLDER, "download_window.py"), "."),
|
||||
(os.path.join(BASE_FOLDER, "utilities.py"), "."),
|
||||
(os.path.join(BASE_FOLDER, "versioncontroller.py"), "."),
|
||||
(os.path.join(BASE_FOLDER, "downloadtargetfactory.py"), "."),
|
||||
(os.path.join(BASE_FOLDER, "executable_utilities.py"), "."),
|
||||
(os.path.join(BASE_FOLDER, "os_utilities.py"), "."),
|
||||
(os.path.join(BASE_FOLDER, "web_utilities.py"), "."),
|
||||
(os.path.join(BASE_FOLDER, "constants.py"), "."),
|
||||
(os.path.join(BASE_FOLDER, "threads.py"), "."),
|
||||
(os.path.join(BASE_FOLDER, "default_imgs_rc.py"), "."),
|
||||
(os.path.join(BASE_FOLDER, "cacert.pem"), "."),
|
||||
]
|
||||
a = Analysis([os.path.join(BASE_FOLDER, 'updater.py')], # noqa: 821
|
||||
pathex=[os.getcwd()],
|
||||
binaries=[],
|
||||
datas=data_file,
|
||||
hiddenimports=[],
|
||||
hookspath=[],
|
||||
runtime_hooks=[],
|
||||
excludes=[],
|
||||
win_no_prefer_redirects=False,
|
||||
win_private_assemblies=False,
|
||||
cipher=block_cipher,
|
||||
noarchive=False)
|
||||
pyz = PYZ(a.pure, # noqa: 821
|
||||
a.zipped_data,
|
||||
cipher=block_cipher)
|
||||
exe = EXE(pyz, # noqa: 821
|
||||
a.scripts,
|
||||
a.binaries,
|
||||
a.zipfiles,
|
||||
a.datas,
|
||||
[],
|
||||
name='_ArtemisUpdater',
|
||||
debug=False,
|
||||
bootloader_ignore_signals=False,
|
||||
strip=False,
|
||||
upx=True,
|
||||
runtime_tmpdir=None,
|
||||
console=False,
|
||||
icon='Artemis3.ico')
|
||||
@@ -16,6 +16,8 @@ Artemis 3 .spec files are used by the package **pyinstaller** (https://www.pyins
|
||||
|
||||
**IMPORTANT (LINUX COMPILING):** *The executable that PyInstaller builds is not fully static, in that it still depends on the system libc. **Under Linux, the ABI of GLIBC is backward compatible, but not forward compatible. So if you link against a newer GLIBC, you can't run the resulting executable on an older system**. The supplied binary bootloader should work with older GLIBC. However, the libpython.so and other dynamic libraries still depend on the newer GLIBC. The solution is to compile the Python interpreter with its modules (and also probably bootloader) on the oldest system you have around so that it gets linked with the oldest version of GLIBC.* (Source: PyInstaller)
|
||||
|
||||
**NOTE.** Depending on the number of packages installed in your python environemnt, the size of the executables file can vary significantly. In order to get the smallest size possible it is recommend to initialize a fresh virtual environment with just the requirements and pyinstaller.
|
||||
|
||||
## Package Building (standalone aka one-file, high portability, **suggested**)
|
||||
1. Download/clone the git repository.
|
||||
2. In the `spec_files/<your OS>` folder open a terminal and type
|
||||
@@ -35,6 +37,16 @@ pyinstaller Artemis_onedir.spec
|
||||
be deleted.
|
||||
|
||||
|
||||
You can save a copy of the executable in a folder of you choice. At startup it will ask you to download
|
||||
the database and also warn you that the `themes` folder is missing. To avoid this,
|
||||
copy `src/Data` and `src/themes` in the folder containing the executable.
|
||||
You can save a copy of the executable in a folder of you choice. At startup it will ask you to download the database and also warn you that the `themes` folder is missing. To avoid this, copy `src/Data` and `src/themes` in the folder containing the executable.
|
||||
|
||||
## Build scripts
|
||||
Provided you satisfy the requirements (see [requirements.txt](../requirements/requirements.txt)) and have pyinstaller installed, running a `build.*` script in `<your os>` folder will produce an `output` folder with:
|
||||
|
||||
- Executable versions of Artemis and the updater;
|
||||
- compressed versions of the same files;
|
||||
- a folder called `Artemis/` containing the executables and the `theme` folder
|
||||
- a compressed version of the folder
|
||||
|
||||
At the end of the process the script writes on standard output the size and sha256 code for the compressed files.
|
||||
|
||||
**NOTE.** For Windows you will need a 7z installation. Also check the path hardcoded in `/Windows/build.bat`.
|
||||
@@ -12,7 +12,8 @@ SRC_PATH = "../../src/"
|
||||
data_file = [
|
||||
(f, '.') for f in glob.glob(SRC_PATH + '*.[pu][yi]')
|
||||
if f.split('/')[-1] != "artemis.py"
|
||||
].append((SRC_PATH + 'cacert.pem', '.'))
|
||||
]
|
||||
data_file.append((SRC_PATH + 'cacert.pem', '.'))
|
||||
|
||||
a = Analysis(SRC_PATH + ['artemis.py'], # noqa: 821
|
||||
pathex=[os.getcwd()],
|
||||
|
||||
@@ -11,8 +11,9 @@ SRC_PATH = "../../src/"
|
||||
|
||||
data_file = [
|
||||
(f, '.') for f in glob.glob(SRC_PATH + '*.[pu][yi]')
|
||||
if f.split('/')[-1] != "artemis.py"
|
||||
].append((SRC_PATH + 'cacert.pem', '.'))
|
||||
if f.split('/')[-1] != "artemis.py" and f.split('/')[-1] != "updater.py"
|
||||
]
|
||||
data_file.append((SRC_PATH + 'cacert.pem', '.'))
|
||||
|
||||
a = Analysis([SRC_PATH + 'artemis.py'], # noqa: 821
|
||||
pathex=[os.getcwd()],
|
||||
@@ -42,4 +43,5 @@ exe = EXE(pyz, # noqa: 821
|
||||
upx=True,
|
||||
runtime_tmpdir=None,
|
||||
console=False,
|
||||
icon='Artemis3.ico')
|
||||
icon='Artemis3.ico',
|
||||
uac_admin=True)
|
||||
|
||||
30
spec_files/Windows/build.bat
Normal file
30
spec_files/Windows/build.bat
Normal file
@@ -0,0 +1,30 @@
|
||||
ECHO OFF
|
||||
ECHO Building Artemis executable...
|
||||
RMDIR /s /q output
|
||||
MKDIR output
|
||||
pyinstaller artemis.spec
|
||||
ECHO Remove directories
|
||||
MOVE dist\Artemis.exe .\output\Artemis.exe
|
||||
RMDIR /s /q dist
|
||||
RMDIR /s /q build
|
||||
ECHO *************
|
||||
ECHO *************
|
||||
ECHO Building updater...
|
||||
pyinstaller updater.spec
|
||||
ECHO Remove directories
|
||||
MOVE dist\_ArtemisUpdater.exe .\output\_ArtemisUpdater.exe
|
||||
RMDIR /s /q dist
|
||||
RMDIR /s /q build
|
||||
CD output
|
||||
MKDIR Artemis
|
||||
XCOPY /y Artemis.exe Artemis\
|
||||
XCOPY /e /k /y ..\..\..\src\themes Artemis\themes\ /EXCLUDE:..\excluded_files.txt
|
||||
XCOPY /y _ArtemisUpdater.exe Artemis\
|
||||
ECHO "Compress files themes+Artemis.exe -> Artemis.zip"
|
||||
"C:\Program Files\7-Zip\7z.exe" a -r Artemis_win.zip Artemis.exe Artemis\themes
|
||||
"C:\Program Files\7-Zip\7z.exe" a _ArtemisUpdater_win.zip _ArtemisUpdater.exe
|
||||
ECHO "Compress all files for website download"
|
||||
"C:\Program Files\7-Zip\7z.exe" a ArtemisWebsite_win.zip Artemis\
|
||||
python ..\..\__get_hash_code.py Artemis_win.zip _ArtemisUpdater_win.zip ArtemisWebsite_win.zip
|
||||
CD ..
|
||||
ECHO Done.
|
||||
1
spec_files/Windows/excluded_files.txt
Normal file
1
spec_files/Windows/excluded_files.txt
Normal file
@@ -0,0 +1 @@
|
||||
__current_theme
|
||||
52
spec_files/Windows/updater.spec
Normal file
52
spec_files/Windows/updater.spec
Normal file
@@ -0,0 +1,52 @@
|
||||
# -*- mode: python ; coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
|
||||
|
||||
BASE_FOLDER = "../../src/"
|
||||
block_cipher = None
|
||||
|
||||
data_file = [
|
||||
(os.path.join(BASE_FOLDER, "download_db_window.ui"), "."),
|
||||
(os.path.join(BASE_FOLDER, "download_window.py"), "."),
|
||||
(os.path.join(BASE_FOLDER, "utilities.py"), "."),
|
||||
(os.path.join(BASE_FOLDER, "versioncontroller.py"), "."),
|
||||
(os.path.join(BASE_FOLDER, "downloadtargetfactory.py"), "."),
|
||||
(os.path.join(BASE_FOLDER, "executable_utilities.py"), "."),
|
||||
(os.path.join(BASE_FOLDER, "os_utilities.py"), "."),
|
||||
(os.path.join(BASE_FOLDER, "web_utilities.py"), "."),
|
||||
(os.path.join(BASE_FOLDER, "constants.py"), "."),
|
||||
(os.path.join(BASE_FOLDER, "threads.py"), "."),
|
||||
(os.path.join(BASE_FOLDER, "default_imgs_rc.py"), "."),
|
||||
(os.path.join(BASE_FOLDER, "cacert.pem"), "."),
|
||||
]
|
||||
a = Analysis([os.path.join(BASE_FOLDER, 'updater.py')], # noqa: 821
|
||||
pathex=[os.getcwd()],
|
||||
binaries=[],
|
||||
datas=data_file,
|
||||
hiddenimports=[],
|
||||
hookspath=[],
|
||||
runtime_hooks=[],
|
||||
excludes=[],
|
||||
win_no_prefer_redirects=False,
|
||||
win_private_assemblies=False,
|
||||
cipher=block_cipher,
|
||||
noarchive=False)
|
||||
pyz = PYZ(a.pure, # noqa: 821
|
||||
a.zipped_data,
|
||||
cipher=block_cipher)
|
||||
exe = EXE(pyz, # noqa: 821
|
||||
a.scripts,
|
||||
a.binaries,
|
||||
a.zipfiles,
|
||||
a.datas,
|
||||
[],
|
||||
name='_ArtemisUpdater',
|
||||
debug=False,
|
||||
bootloader_ignore_signals=False,
|
||||
strip=False,
|
||||
upx=True,
|
||||
runtime_tmpdir=None,
|
||||
console=False,
|
||||
icon='Artemis3.ico',
|
||||
uac_admin=True)
|
||||
31
spec_files/__get_hash_code.py
Normal file
31
spec_files/__get_hash_code.py
Normal file
@@ -0,0 +1,31 @@
|
||||
import hashlib
|
||||
import sys
|
||||
|
||||
|
||||
"""Print on stadard output the size in KB and sha256 codes of a list
|
||||
of command line-provided file names."""
|
||||
|
||||
print()
|
||||
|
||||
try:
|
||||
fnames = sys.argv[1:]
|
||||
except Exception:
|
||||
print("Provide a valid filename.")
|
||||
exit()
|
||||
|
||||
for fname in fnames:
|
||||
try:
|
||||
with open(fname, mode='rb') as f:
|
||||
target = f.read()
|
||||
except Exception:
|
||||
print("File not found")
|
||||
exit()
|
||||
|
||||
code = hashlib.sha256()
|
||||
code.update(target)
|
||||
hash_code = code.hexdigest()
|
||||
|
||||
print("File name:", fname)
|
||||
print("Size (KB):", round(len(target) / 1024, 3))
|
||||
print("Hash code:", hash_code)
|
||||
print("-" * 80)
|
||||
@@ -12,7 +12,8 @@ SRC_PATH = "../../src/"
|
||||
data_file = [
|
||||
(f, '.') for f in glob.glob(SRC_PATH + '*.[pu][yi]')
|
||||
if f.split('/')[-1] != "artemis.py"
|
||||
].extend(((SRC_PATH + 'cacert.pem', '.'), ('themes', './themes')))
|
||||
]
|
||||
data_file.extend(((SRC_PATH + 'cacert.pem', '.'), ((SRC_PATH + 'themes', './themes')))
|
||||
|
||||
a = Analysis([SRC_PATH + 'artemis.py'], # noqa: 821
|
||||
pathex=[os.getcwd()],
|
||||
|
||||
Reference in New Issue
Block a user