On Tue, 2012-04-17 at 23:30 -0700, Ross Brattain wrote:
> Hi,
>
> I am adding some networking tests to autotest. I have modified the Exscript
> library https://github.com/knipknap/exscript to support some Brocade switches.
>
> For server-side use I added Exscript to autotest/site-packages. I would like
> to use Exscript client side, I'm thinking of putting in it
> autotest/client/site-packages, but that would requires modifying
> client/setup_modules.py to update sys.path.
>
> Something like:
>
> diff --git a/client/setup_modules.py b/client/setup_modules.py
> index 619702b..845637f 100644
> --- a/client/setup_modules.py
> +++ b/client/setup_modules.py
> @@ -140,4 +140,6 @@ def setup(base_path, root_module_name=""):
> # may use libraries other than those available as system packages.
> sys.path.insert(0, os.path.join(base_path, "site-packages"))
>
> + sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__),
> 'site-packages')))
^ Yes, it is along these lines. Actually we could just do something
like:
diff --git a/client/setup_modules.py b/client/setup_modules.py
index 619702b..42525cc 100644
--- a/client/setup_modules.py
+++ b/client/setup_modules.py
@@ -132,12 +132,8 @@ def setup(base_path, root_module_name=""):
_create_module_and_parents(root_module_name)
_import_children_into_module(root_module_name, base_path)
- if root_module_name == 'autotest_lib':
- # Allow locally installed third party packages to be found
- # before any that are installed on the system itself when not.
- # running as a client.
- # This is primarily for the benefit of frontend and tko so that they
- # may use libraries other than those available as system packages.
- sys.path.insert(0, os.path.join(base_path, "site-packages"))
+ # Allow locally installed third party packages to be found
+ # before any that are installed on the system itself.
+ sys.path.insert(0, os.path.join(base_path, "site-packages"))
_monkeypatch_logging_handle_error()
(I messed up with this code a lot lately :))
So yes, we can definitely do it. About using client site packages, I
believe this code should suffice. If you want to trigger automatic
installation, perhaps you can use the client/deps mechanism. I don't
recall whether it this particular mechanism is site extensible, if not
it probably shouldn't be too hard to add.
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest