Skip to content

Commit f783e93

Browse files
authored
Add pyinstaller support to signxml (#188)
1 parent 70c3adc commit f783e93

File tree

4 files changed

+22
-1
lines changed

4 files changed

+22
-1
lines changed

setup.cfg

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,9 @@ universal=1
33
[flake8]
44
max-line-length=120
55
ignore: E301, E302, E305, E401, E226, F841
6+
[coverage:run]
7+
omit =
8+
signxml/__pyinstaller/*
9+
[options.entry_points]
10+
pyinstaller40 =
11+
hook-dirs = signxml.__pyinstaller:get_hook_dirs

signxml/__pyinstaller/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
"""
2+
This file indicates that this directory contains the hooks to include the schema files on the final version
3+
if it's compiled with pyinstaller.
4+
"""
5+
6+
import os
7+
8+
9+
def get_hook_dirs():
10+
return [os.path.dirname(__file__)]

signxml/__pyinstaller/hook-signxml.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
"""Hook for pyinstaller to include the files are signxml/schemas/* into the final build."""
2+
3+
from PyInstaller.utils.hooks import collect_data_files
4+
5+
datas = collect_data_files('signxml', excludes=['__pyinstaller'])

signxml/util/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ class XMLProcessor:
133133
@classmethod
134134
def schema(cls):
135135
if cls._schema is None:
136-
schema_path = os.path.join(os.path.dirname(__file__), "..", "schemas", cls.schema_file)
136+
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), "..", "schemas", cls.schema_file))
137137
cls._schema = etree.XMLSchema(etree.parse(schema_path))
138138
return cls._schema
139139

0 commit comments

Comments
 (0)