Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
colorama==0.3.9
oletools==0.60
pyinstaller==4.10
pyinstaller==6.3.0
9 changes: 9 additions & 0 deletions scripts/linux/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

set -e

export PYTHON_ARCH=$(python -c "import sys;print('x64' if sys.maxsize > 2**32 else 'x86')")

python ./scripts/linux/update-version-info.py
pyinstaller --onefile ./src/diff.py --name=git-xl-diff-$PYTHON_ARCH --version-file ./scripts/windows/git-xl-version-info.py --icon ./scripts/windows/git-xl-logo.ico
pyinstaller --onefile ./src/cli.py --name=git-xl-$PYTHON_ARCH --version-file ./scripts/windows/git-xl-version-info.py --icon ./scripts/windows/git-xl-logo.ico
66 changes: 66 additions & 0 deletions scripts/linux/update-version-info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import os
import json
import re

base_directory = os.path.join('scripts', 'linux')

# read build number, repo tag name and git commit hash from env vars
build = os.getenv('APPVEYOR_BUILD_NUMBER', '0')
version = os.getenv('APPVEYOR_REPO_TAG_NAME', '0.0.0')
commit = os.environ['APPVEYOR_REPO_COMMIT'][:7] if os.getenv('APPVEYOR_REPO_COMMIT') else 'dev'

print('-----------')
print('Version tag: %s' % version)
print('Build number: %s' % build)
print('Commit hash: %s' % commit)

major, minor, patch = version.split('.')
print(f'Generate file version: {major}.{minor}.{patch}.{build}')
print('-----------')



s = f"""VSVersionInfo(
ffi=FixedFileInfo(
filevers=({major}, {minor}, {patch}, {build}),
prodvers=({major}, {minor}, {patch}, {build}),
mask=0x3f,
flags=0x0,
OS=0x40004,
fileType=0x1,
subtype=0x0,
date=(0, 0)
),
kids=[
StringFileInfo(
[
StringTable(
u'040904B0',
[StringStruct(u'CompanyName', u'Zoomer Analytics LLC'),
StringStruct(u'FileDescription', u'Git XL'),
StringStruct(u'FileVersion', u'{major}.{minor}.{patch}'),
StringStruct(u'InternalName', u'git-xl'),
StringStruct(u'LegalCopyright', u'Zoomer Analytics LLC'),
StringStruct(u'OriginalFilename', u'git-xl'),
StringStruct(u'ProductName', u'Git XL'),
StringStruct(u'ProductVersion', u'{major}.{minor}.{patch}')])
]),
VarFileInfo([VarStruct(u'Translation', [1033, 1200])])
]
)"""

# update 'git-xl-version-info.py
path = os.path.join(base_directory, 'git-xl-version-info.py')
with open(path, 'w') as f:
f.write(s)

# update git-xl.py (VERSION and COMMIT)
path = 'src/cli.py'
with open(path, 'r') as f:
s = f.read()

s = re.sub("VERSION\s*=\s*('|\")\d\.\d.\d('|\")", f"VERSION = '{major}.{minor}.{patch}'", s, re.MULTILINE)
s = re.sub("GIT_COMMIT\s*=\s*('|\")[a-zA-Z0-9]*('|\")", f"GIT_COMMIT = '{commit}'", s, re.MULTILINE)

with open(path, 'w') as f:
f.write(s)