Skip to content

Commit

Permalink
Add pyinstaller support to signxml (#188)
Browse files Browse the repository at this point in the history
  • Loading branch information
bvanelli authored Jul 2, 2022
1 parent 70c3adc commit f783e93
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
6 changes: 6 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@ universal=1
[flake8]
max-line-length=120
ignore: E301, E302, E305, E401, E226, F841
[coverage:run]
omit =
signxml/__pyinstaller/*
[options.entry_points]
pyinstaller40 =
hook-dirs = signxml.__pyinstaller:get_hook_dirs
10 changes: 10 additions & 0 deletions signxml/__pyinstaller/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"""
This file indicates that this directory contains the hooks to include the schema files on the final version
if it's compiled with pyinstaller.
"""

import os


def get_hook_dirs():
return [os.path.dirname(__file__)]
5 changes: 5 additions & 0 deletions signxml/__pyinstaller/hook-signxml.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"""Hook for pyinstaller to include the files are signxml/schemas/* into the final build."""

from PyInstaller.utils.hooks import collect_data_files

datas = collect_data_files('signxml', excludes=['__pyinstaller'])
2 changes: 1 addition & 1 deletion signxml/util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class XMLProcessor:
@classmethod
def schema(cls):
if cls._schema is None:
schema_path = os.path.join(os.path.dirname(__file__), "..", "schemas", cls.schema_file)
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), "..", "schemas", cls.schema_file))
cls._schema = etree.XMLSchema(etree.parse(schema_path))
return cls._schema

Expand Down

0 comments on commit f783e93

Please sign in to comment.