Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(6)  |  Call(3)  |  Derive(0)  |  Import(3)
Adds the vendor library to the front of sys.path.

        def add_vendor_lib():
    """
    Adds the vendor library to the front of sys.path.

    """
    base_dir = os.path.dirname(
        os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
    vendor_lib = os.path.join(
        base_dir, "requirements", "vendor", "lib", "python")

    orig_sys_path = set(sys.path)

    # Add vendor-lib directory to sys.path (using site.addsitedir so pth
    # files are processed)
    site.addsitedir(vendor_lib)

    # Give vendor lib precedence over global Python environment
    new_sys_path = []
    for item in list(sys.path):
        if item not in orig_sys_path:
            new_sys_path.append(item)
            sys.path.remove(item)
    sys.path[:0] = new_sys_path
        


src/m/o/moztrap-HEAD/moztrap/deploy/vendor_wsgi.py   moztrap(Download)
sys.path.insert(0, base_dir)
 
from moztrap.deploy.paths import add_vendor_lib
add_vendor_lib()
 

src/m/o/moztrap-HEAD/vendor-manage.py   moztrap(Download)
"""
import os, sys
from moztrap.deploy.paths import add_vendor_lib
 
if __name__ == "__main__":
    add_vendor_lib()

src/m/o/moztrap-HEAD/tests/deploy/test_paths.py   moztrap(Download)
    def add_vendor_lib(self):
        """Import and call the function."""
        from moztrap.deploy.paths import add_vendor_lib
        add_vendor_lib()