Skip to content

Commit b5de1c8

Browse files
authored
Merge pull request #2 from FluxIX/develop
Initial Publishing
2 parents cf45567 + f42f9f4 commit b5de1c8

40 files changed

+1145
-0
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
*.pyc
2+
*.bak
3+
__pycache__
4+
dist
5+
build
6+
*.egg-info

.project

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>PyPluginEngine</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.python.pydev.PyDevBuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.python.pydev.pythonNature</nature>
16+
</natures>
17+
</projectDescription>

.pydevproject

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<?eclipse-pydev version="1.0"?><pydev_project>
3+
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
4+
<path>/${PROJECT_DIR_NAME}/src</path>
5+
</pydev_pathproperty>
6+
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python interpreter</pydev_property>
7+
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
8+
</pydev_project>

Examples/Example 1/.project

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>PyPluginEngine Example 1</name>
4+
<comment></comment>
5+
<projects>
6+
<project>PyPluginEngine</project>
7+
</projects>
8+
<buildSpec>
9+
<buildCommand>
10+
<name>org.python.pydev.PyDevBuilder</name>
11+
<arguments>
12+
</arguments>
13+
</buildCommand>
14+
</buildSpec>
15+
<natures>
16+
<nature>org.python.pydev.pythonNature</nature>
17+
</natures>
18+
</projectDescription>

Examples/Example 1/.pydevproject

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<?eclipse-pydev version="1.0"?><pydev_project>
3+
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
4+
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python interpreter</pydev_property>
5+
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
6+
<path>/${PROJECT_DIR_NAME}/src</path>
7+
</pydev_pathproperty>
8+
</pydev_project>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
plugin_engine

Examples/Example 1/src/__main__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Cannot use a relative import here.
2+
from command_executor.main import main as entry_point
3+
4+
if __name__ == '__main__':
5+
import sys
6+
ret_value = entry_point()
7+
8+
sys.exit( ret_value )

Examples/Example 1/src/command_executor/__init__.py

Whitespace-only changes.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import sys
2+
from .main import main as entry_point
3+
4+
if __name__ == "__main__":
5+
script_name = sys.argv[ 0 ]
6+
7+
sys.exit( entry_point() )
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
from typing import Dict
2+
3+
from multiprocessing import RLock
4+
from plugin_engine.plugin_importer import PluginImporter
5+
from .command import Command
6+
from . import plugins
7+
from .plugins import _commands
8+
9+
_lock: RLock = RLock()
10+
_plugin_importer: PluginImporter = None
11+
12+
def get_registered_commands() -> Dict[ str, Command ]:
13+
"""
14+
Gets the registered commands.
15+
"""
16+
17+
global _lock, _plugin_importer
18+
19+
with _lock:
20+
if _plugin_importer is None:
21+
_plugin_importer = PluginImporter( plugins )
22+
_plugin_importer.import_modules( recursive = True )
23+
24+
return _commands

0 commit comments

Comments
 (0)