pyolian: make the library and the generator importable from another folder
This commit is contained in:
parent
763942d8c7
commit
b5e3853e9d
|
@ -41,6 +41,8 @@ tags
|
||||||
*.eot.cs
|
*.eot.cs
|
||||||
*.eo.lua
|
*.eo.lua
|
||||||
*.luac
|
*.luac
|
||||||
|
*.pyc
|
||||||
|
__pycache__
|
||||||
.dir-locals.el
|
.dir-locals.el
|
||||||
/efl-*-doc.tar.bz2
|
/efl-*-doc.tar.bz2
|
||||||
/ar-lib
|
/ar-lib
|
||||||
|
|
|
@ -14,11 +14,23 @@ You can directly use the python API provided here if you need direct access
|
||||||
to eolian, or we suggest to look at the template-based generator.py if you just
|
to eolian, or we suggest to look at the template-based generator.py if you just
|
||||||
need to generate some sort of text files out of the eolian database.
|
need to generate some sort of text files out of the eolian database.
|
||||||
|
|
||||||
|
To use this library from outside this directory, you need to hack sys.path in
|
||||||
|
a way that this folder will be available on PYTHON_PATH, fe:
|
||||||
|
|
||||||
|
pyolian_path = os.path.join(EFL_ROOT_PATH, 'src', 'scripts')
|
||||||
|
sys.path.insert(0, pyolian_path)
|
||||||
|
from pyolian import eolian
|
||||||
|
from pyolian.generator import Template
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from enum import IntEnum
|
from enum import IntEnum
|
||||||
from ctypes import cast, byref, c_char_p, c_void_p
|
from ctypes import cast, byref, c_char_p, c_void_p
|
||||||
|
|
||||||
from eolian_lib import lib
|
try:
|
||||||
|
from .eolian_lib import lib
|
||||||
|
except ImportError:
|
||||||
|
from eolian_lib import lib
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Eolian Enums ############################################################
|
### Eolian Enums ############################################################
|
||||||
|
|
|
@ -15,9 +15,6 @@ For example (from this source folder):
|
||||||
|
|
||||||
...of course you can pass any other class or namespace to the example above.
|
...of course you can pass any other class or namespace to the example above.
|
||||||
|
|
||||||
You can also import this module and use the provided Template class if you
|
|
||||||
are more confortable from within python.
|
|
||||||
|
|
||||||
The generator is based on the great pyratemp engine (THANKS!), you can find
|
The generator is based on the great pyratemp engine (THANKS!), you can find
|
||||||
the full template syntax at: www.simple-is-better.org/template/pyratemp.html
|
the full template syntax at: www.simple-is-better.org/template/pyratemp.html
|
||||||
|
|
||||||
|
@ -30,12 +27,27 @@ Just keep in mind the syntax is a bit different in this implementation:
|
||||||
comment_start = "#!"
|
comment_start = "#!"
|
||||||
comment_end = "!#"
|
comment_end = "!#"
|
||||||
|
|
||||||
|
|
||||||
|
You can also import this module and use the provided Template class if you
|
||||||
|
are more confortable from within python. To import from outside this directory
|
||||||
|
you need to hack sys.path in a way that this folder will be available on
|
||||||
|
PYTHON_PATH, fe:
|
||||||
|
|
||||||
|
pyolian_path = os.path.join(EFL_ROOT_PATH, 'src', 'scripts')
|
||||||
|
sys.path.insert(0, pyolian_path)
|
||||||
|
from pyolian.generator import Template
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
import eolian
|
try:
|
||||||
import pyratemp
|
from . import eolian
|
||||||
|
from . import pyratemp
|
||||||
|
except ImportError:
|
||||||
|
import eolian
|
||||||
|
import pyratemp
|
||||||
|
|
||||||
|
|
||||||
# logging utils
|
# logging utils
|
||||||
|
|
Loading…
Reference in New Issue