Skip to content

Commit

Permalink
Fix windows installer (#223)
Browse files Browse the repository at this point in the history
* support packages that don't have wheels

* temporarily run on test tag

* temporarily disable ci

* add debug print

* fix

* more visible debug print

* Revert "temporarily run on test tag"

This reverts commit 4edc725.

* Revert "temporarily disable ci"

This reverts commit 77dbdb8.
  • Loading branch information
Akuli authored Jan 30, 2021
1 parent 6d41934 commit cf71de4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ toposort>=1.5
colorama>=0.2.5
sansio-lsp-client>=0.8.0,<0.9.0
python-language-server>=0.36.2,<1.0.0
# can't put black here, breaks windows installer build
black>=20.8b1
# typing.Literal is new in python 3.8
typing_extensions
dacite>=1.5.1,<2.0.0
Expand Down
23 changes: 19 additions & 4 deletions scripts/build-exe-installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ def get_frozen_requirements_in_a_crazy_way():
frozen = subprocess.check_output([r'temp_env\Scripts\python.exe', '-m', 'pip', 'freeze'])
finally:
shutil.rmtree('temp_env')
return [requirement for requirement in frozen.decode('utf-8').strip().splitlines()
if not requirement.lower().startswith('porcupine==')]
return frozen.decode('utf-8').strip().splitlines()


# https://pynsist.readthedocs.io/en/latest/faq.html#packaging-with-tkinter
Expand All @@ -59,6 +58,18 @@ def create_ico_file():

def create_pynsist_cfg():
info("Creating pynsist.cfg...")

deps_from_pypi_wheels = []
deps_without_pypi_wheels = ['tkinter', '_tkinter']
for dependency in get_frozen_requirements_in_a_crazy_way():
name, version = dependency.split('==')
if name.lower() == 'porcupine':
pass
elif name.lower() in {'ttkthemes', 'black'}:
deps_without_pypi_wheels.append(name)
else:
deps_from_pypi_wheels.append(dependency)

parser = configparser.ConfigParser()
parser['Application'] = {
'name': 'Porcupine',
Expand All @@ -71,10 +82,14 @@ def create_pynsist_cfg():
'version': '%d.%d.%d' % sys.version_info[:3],
}
parser['Include'] = {
'pypi_wheels': '\n'.join(get_frozen_requirements_in_a_crazy_way()),
'packages': 'tkinter\n_tkinter',
'pypi_wheels': '\n'.join(deps_from_pypi_wheels),
'packages': '\n'.join(deps_without_pypi_wheels),
'files': 'porcupine/images\nlib',
}

parser.write(sys.stderr)
sys.stderr.flush()

with open('pynsist.cfg', 'w') as file:
parser.write(file)

Expand Down

0 comments on commit cf71de4

Please sign in to comment.