add support for an ESCPOS_CAPABILITIES_FILE environment variable. This is useful in situations where package structure is changed, such as using cx-freeze
This commit is contained in:
parent
7b24df6581
commit
a0ef820947
|
@ -1,10 +1,15 @@
|
||||||
import re
|
import re
|
||||||
import six
|
import six
|
||||||
from os import path
|
from os import environ, path
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
# Load external printer database
|
# Load external printer database
|
||||||
with open(path.join(path.dirname(__file__), 'capabilities.json')) as f:
|
if 'ESCPOS_CAPABILITIES_FILE' in environ:
|
||||||
|
file_path = environ['ESCPOS_CAPABILITIES_FILE']
|
||||||
|
else:
|
||||||
|
file_path = path.join(path.dirname(__file__), 'capabilities.json')
|
||||||
|
|
||||||
|
with open(file_path) as f:
|
||||||
CAPABILITIES = yaml.load(f)
|
CAPABILITIES = yaml.load(f)
|
||||||
|
|
||||||
PROFILES = CAPABILITIES['profiles']
|
PROFILES = CAPABILITIES['profiles']
|
||||||
|
|
Loading…
Reference in New Issue