]> git-server-git.apps.pok.os.sepia.ceph.com Git - remoto.git/commitdiff
removes the ability to vendor execnet
authorAndrew Schoen <aschoen@redhat.com>
Mon, 3 Jul 2017 16:44:50 +0000 (11:44 -0500)
committerAndrew Schoen <aschoen@redhat.com>
Mon, 3 Jul 2017 16:50:22 +0000 (11:50 -0500)
Fixes https://github.com/alfredodeza/remoto/issues/29

Signed-off-by: Andrew Schoen <aschoen@redhat.com>
MANIFEST.in
remoto/connection.py
remoto/exc.py
remoto/file_sync.py
remoto/lib/__init__.py [deleted file]
remoto/lib/vendor/__init__.py [deleted file]
setup.py
vendor.py [deleted file]

index c0afbfe275afc64b0c205b8d1d761c1631a70ce8..2f42070f4868acfe1efc09edfab06214977b34e1 100644 (file)
@@ -1,4 +1,3 @@
 include setup.py
 include LICENSE
 include README.rst
-include vendor.py
index 3d6851c14bf4dc286c6cb6c672e606b65970e95e..462febee7d3d81a22a8dad79ae29a8ca531ac742 100644 (file)
@@ -1,6 +1,6 @@
 import socket
 import sys
-from .lib import execnet
+import execnet
 
 
 #
index 9b3acf935edb0561630216a6b7819caf394f19f7..03f891f2250aaeae7a8ae56839c6c0ff782a081e 100644 (file)
@@ -1,4 +1,4 @@
-from .lib import execnet
+import execnet
 
 HostNotFound = execnet.HostNotFound
 RemoteError = execnet.RemoteError
index 3445098a237d86d78ac01f09226f89627e840509..c23e45b08af2d3cc29683cea2d9bb1018f9f2304 100644 (file)
@@ -1,4 +1,4 @@
-from .lib import execnet
+import execnet
 from .connection import Connection, FakeRemoteLogger
 
 
diff --git a/remoto/lib/__init__.py b/remoto/lib/__init__.py
deleted file mode 100644 (file)
index 8b42e37..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-"""
-This module is meant for vendorizing Python libraries. Most libraries will need
-to have some ``sys.path`` alterations done unless they are doing relative
-imports.
-
-Do **not** add anything to this module that does not represent a vendorized
-library.
-
-Vendored libraries should go into the ``vendor`` directory and imported from
-there. This is so we allow libraries that are installed normally to be imported
-if the vendored module is not available.
-
-The import dance here is done so that all other imports throught ceph-deploy
-are kept the same regardless of where the module comes from.
-
-The expected way to import execnet would look like this::
-
-    from remoto.lib import execnet
-
-"""
-import sys
-import os
-this_dir = os.path.abspath(os.path.dirname(__file__))
-vendor_dir = os.path.join(this_dir, 'vendor')
-
-try:
-    # vendored
-    if vendor_dir not in sys.path:
-        sys.path.insert(0, vendor_dir)
-    import execnet
-except ImportError as err:
-    # normally installed
-    import execnet  # noqa
-
diff --git a/remoto/lib/vendor/__init__.py b/remoto/lib/vendor/__init__.py
deleted file mode 100644 (file)
index e69de29..0000000
index 24714fc0879b688df331c8c0fc639e561925ccae..1058e29de3fd499ab0359abfd0c5df4f7979eb5d 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -1,27 +1,12 @@
-import os
 import re
 
-from vendor import vendorize, clean_vendor
-
-
 module_file = open("remoto/__init__.py").read()
 metadata = dict(re.findall(r"__([a-z]+)__\s*=\s*['\"]([^'\"]*)['\"]", module_file))
 long_description = open('README.rst').read()
+install_requires = []
 
 from setuptools import setup, find_packages
 
-#
-# Add libraries that are not part of install_requires but only if we really
-# want to, specified by the environment flag
-#
-
-if os.environ.get('REMOTO_NO_VENDOR'):
-    clean_vendor('execnet')
-else:
-    vendorize([
-        ('execnet', '1.2post2', 'https://github.com/alfredodeza/execnet'),
-    ])
-
 
 setup(
     name = 'remoto',
@@ -34,6 +19,9 @@ setup(
     license = "MIT",
     zip_safe = False,
     keywords = "remote, commands, unix, ssh, socket, execute, terminal",
+    install_requires=[
+        'execnet',
+    ] + install_requires,
     long_description = long_description,
     classifiers = [
         'Development Status :: 4 - Beta',
diff --git a/vendor.py b/vendor.py
deleted file mode 100644 (file)
index 1840f43..0000000
--- a/vendor.py
+++ /dev/null
@@ -1,105 +0,0 @@
-import subprocess
-import os
-from os import path
-import re
-import traceback
-import sys
-
-
-error_msg = """
-This library depends on sources fetched when packaging that failed to be
-retrieved.
-
-This means that it will *not* work as expected. Errors encountered:
-"""
-
-
-def run(cmd):
-    sys.stdout.write('[vendoring] Running command: %s\n' % ' '.join(cmd))
-    try:
-        result = subprocess.Popen(
-            cmd,
-            stderr=subprocess.PIPE,
-            stdout=subprocess.PIPE
-        )
-    except Exception:
-        # if building with python2.5 this makes it compatible
-        _, error, _ = sys.exc_info()
-        print_error([], traceback.format_exc(error).split('\n'))
-        raise SystemExit(1)
-
-    if result.wait():
-        print_error(result.stdout.readlines(), result.stderr.readlines())
-
-
-def print_error(stdout, stderr):
-    sys.stderr.write('*\n'*80)
-    sys.stderr.write(str(error_msg)+'\n')
-    for line in stdout:
-        sys.stderr.write(str(line)+'\n')
-    for line in stderr:
-        sys.stderr.write(str(line)+'\n')
-    sys.stderr.write('*'*80+'\n')
-
-
-def vendor_library(name, version, git_repo):
-    this_dir = path.dirname(path.abspath(__file__))
-    vendor_dest = path.join(this_dir, 'remoto/lib/vendor/%s' % name)
-    vendor_init = path.join(vendor_dest, '__init__.py')
-    vendor_src = path.join(this_dir, name)
-    vendor_module = path.join(vendor_src, name)
-    current_dir = os.getcwd()
-
-    if path.exists(vendor_src):
-        run(['rm', '-rf', vendor_src])
-
-    if path.exists(vendor_init):
-        module_file = open(vendor_init).read()
-        metadata = dict(re.findall(r"__([a-z]+)__\s*=\s*['\"]([^'\"]*)['\"]", module_file))
-        if metadata.get('version') != version:
-            run(['rm', '-rf', vendor_dest])
-
-    if not path.exists(vendor_dest):
-        run(['git', 'clone', git_repo])
-        os.chdir(vendor_src)
-        run(['git', 'checkout', version])
-        run(['mv', vendor_module, vendor_dest])
-    os.chdir(current_dir)
-
-
-def clean_vendor(name):
-    """
-    Ensure that vendored code/dirs are removed, possibly when packaging when
-    the environment flag is set to avoid vendoring.
-    """
-    this_dir = path.dirname(path.abspath(__file__))
-    vendor_dest = path.join(this_dir, 'remoto/lib/vendor/%s' % name)
-    run(['rm', '-rf', vendor_dest])
-
-
-def vendorize(vendor_requirements):
-    """
-    This is the main entry point for vendorizing requirements. It expects
-    a list of tuples that should contain the name of the library and the
-    version.
-
-    For example, a library ``foo`` with version ``0.0.1`` would look like::
-
-        vendor_requirements = [
-            ('foo', '0.0.1', 'https://example.com/git_repo'),
-        ]
-    """
-
-    for library in vendor_requirements:
-        name, version, repo = library
-        vendor_library(name, version, repo)
-
-
-if __name__ == '__main__':
-    # XXX define this in one place, so that we avoid making updates
-    # in two places
-    vendor_requirements = [
-        ('execnet', '1.2post2', 'https://github.com/alfredodeza/execnet'),
-    ]
-    vendorize(vendor_requirements)
-