Created
November 23, 2012 01:14
-
-
Save axw/4133527 to your computer and use it in GitHub Desktop.
Remotely import a local package with Pushy
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
import pushy | |
# Load the local package into a "PushyPackageLoader". This takes care of loading package | |
# sources and crafting them into a structure that can be loaded by "InMemoryImporter". | |
import whatever | |
loader = pushy.client.PushyPackageLoader() | |
packages = loader.load(whatever) | |
with pushy.connect("ssh:remotehost") as conn: | |
remote_importer = conn.modules.pushy.client.InMemoryImporter(*packages) | |
conn.modules.sys.meta_path.insert(0, remote_importer) | |
whatever = conn.remote_import("whatever") | |
print whatever.hostname() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment