Created
July 2, 2015 14:52
-
-
Save cmltaWt0/d7c54024c9ce3c885643 to your computer and use it in GitHub Desktop.
deploy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def deploy(modname, username, app_name, prefix='.fsm_plugin.'): | |
""" | |
Load FSM specifications found in the specified plugin module. | |
""" | |
import importlib | |
mod = importlib.import_module(app_name + prefix + modname) | |
l = [] | |
for fsmSpec in mod.get_specs(): | |
l.append(fsmSpec.save_graph(username)) | |
return l | |
def deploy_all(username, ignore=('testme', '__init__', 'fsmspec'), | |
pattern='*/fsm_plugin/*.py'): | |
""" | |
Load all FSM specifications found via pattern but not ignore. | |
""" | |
import glob | |
import os.path | |
l = [] | |
for modpath in glob.glob(pattern): | |
modname = os.path.basename(modpath)[:-3] | |
app_name = modpath.split('/')[0] | |
if modname not in ignore: | |
l += deploy(modname, username, app_name) | |
return l |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have added app_name param to pass to
deploy
func.