-
Notifications
You must be signed in to change notification settings - Fork 338
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test data to load plugins from entry points
Signed-off-by: Nig3l <[email protected]>
- Loading branch information
Showing
8 changed files
with
128 additions
and
6 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.egg-info |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
""" | ||
baz plugin | ||
""" | ||
|
||
from rez.command import Command | ||
|
||
# This attribute is optional, default behavior will be applied if not present. | ||
command_behavior = { | ||
"hidden": False, # (bool): default False | ||
"arg_mode": None, # (str): "passthrough", "grouped", default None | ||
} | ||
|
||
|
||
def setup_parser(parser, completions=False): | ||
parser.add_argument( | ||
"-m", "--message", action="store_true", help="Print message from world." | ||
) | ||
|
||
|
||
def command(opts, parser=None, extra_arg_groups=None): | ||
from baz import core | ||
|
||
if opts.message: | ||
msg = core.get_message_from_tmp() | ||
print(msg) | ||
return | ||
|
||
print("Please use '-h' flag to see what you can do to this world !") | ||
|
||
|
||
class BazCommand(Command): | ||
@classmethod | ||
def name(cls): | ||
return "baz" | ||
|
||
|
||
def register_plugin(): | ||
return BazCommand |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
""" | ||
baz plugin | ||
""" | ||
|
||
from rez.command import Command | ||
|
||
# This attribute is optional, default behavior will be applied if not present. | ||
command_behavior = { | ||
"hidden": False, # (bool): default False | ||
"arg_mode": None, # (str): "passthrough", "grouped", default None | ||
} | ||
|
||
|
||
def setup_parser(parser, completions=False): | ||
parser.add_argument( | ||
"-m", "--message", action="store_true", help="Print message from world." | ||
) | ||
|
||
|
||
def command(opts, parser=None, extra_arg_groups=None): | ||
from baz import core | ||
|
||
if opts.message: | ||
msg = core.get_message_from_baz() | ||
print(msg) | ||
return | ||
|
||
print("Please use '-h' flag to see what you can do to this world !") | ||
|
||
|
||
class BazCommand(Command): | ||
@classmethod | ||
def name(cls): | ||
return "baz" | ||
|
||
|
||
def register_plugin(): | ||
return BazCommand |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
def get_message_from_baz(): | ||
from rez.config import config | ||
message = config.plugins.command.baz.message | ||
return message |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
baz = { | ||
"message": "welcome to this world." | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from __future__ import print_function, with_statement | ||
from setuptools import setup, find_packages | ||
|
||
|
||
setup( | ||
name="baz", | ||
version="0.1.0", | ||
package_dir={ | ||
"baz": "baz" | ||
}, | ||
packages=find_packages(where="."), | ||
entry_points={ | ||
'rez.plugins': [ | ||
'baz_cmd = baz', | ||
] | ||
} | ||
) |
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
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