python类main()的实例源码

build.py 文件源码 项目:ardy 作者: avara1986 项目源码 文件源码 阅读 38 收藏 0 点赞 0 评论 0
def _install_packages(self, path, packages):
        """Install all packages listed to the target directory.
        Ignores any package that includes Python itself and python-lambda as well
        since its only needed for deploying and not running the code
        :param str path:
            Path to copy installed pip packages to.
        :param list packages:
            A list of packages to be installed via pip.
        """

        def _filter_blacklist(package):
            blacklist = ["-i", "#", "Python==", "ardy=="]
            return all(package.startswith(entry.encode()) is False for entry in blacklist)

        filtered_packages = filter(_filter_blacklist, packages)
        # print([package for package in filtered_packages])
        for package in filtered_packages:
            if package.startswith(b'-e '):
                package = package.replace('-e ', '')

            logger.info('Installing {package}'.format(package=package))
            pip.main(['install', package, '-t', path, '--ignore-installed', '-q'])
get-pip.py 文件源码 项目:geekcloud 作者: Mr-Linus 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def main():
    tmpdir = None
    try:
        # Create a temporary working directory
        tmpdir = tempfile.mkdtemp()

        # Unpack the zipfile into the temporary directory
        pip_zip = os.path.join(tmpdir, "pip.zip")
        with open(pip_zip, "wb") as fp:
            fp.write(b85decode(DATA.replace(b"\n", b"")))

        # Add the zipfile to sys.path so that we can import it
        sys.path.insert(0, pip_zip)

        # Run the bootstrap
        bootstrap(tmpdir=tmpdir)
    finally:
        # Clean up our temporary working directory
        if tmpdir:
            shutil.rmtree(tmpdir, ignore_errors=True)
get-pip.py 文件源码 项目:tensorflow-study 作者: bob-chen 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def main():
    tmpdir = None
    try:
        # Create a temporary working directory
        tmpdir = tempfile.mkdtemp()

        # Unpack the zipfile into the temporary directory
        pip_zip = os.path.join(tmpdir, "pip.zip")
        with open(pip_zip, "wb") as fp:
            fp.write(b85decode(DATA.replace(b"\n", b"")))

        # Add the zipfile to sys.path so that we can import it
        sys.path.insert(0, pip_zip)

        # Run the bootstrap
        bootstrap(tmpdir=tmpdir)
    finally:
        # Clean up our temporary working directory
        if tmpdir:
            shutil.rmtree(tmpdir, ignore_errors=True)
get-pip.py 文件源码 项目:AlmostSignificant 作者: bartongroup 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def main():
    tmpdir = None
    try:
        # Create a temporary working directory
        tmpdir = tempfile.mkdtemp()

        # Unpack the zipfile into the temporary directory
        pip_zip = os.path.join(tmpdir, "pip.zip")
        with open(pip_zip, "wb") as fp:
            fp.write(b85decode(DATA.replace(b"\n", b"")))

        # Add the zipfile to sys.path so that we can import it
        sys.path.insert(0, pip_zip)

        # Run the bootstrap
        bootstrap(tmpdir=tmpdir)
    finally:
        # Clean up our temporary working directory
        if tmpdir:
            shutil.rmtree(tmpdir, ignore_errors=True)
get-pip.py 文件源码 项目:Twitter-and-IMDB-Sentimental-Analytics 作者: abhinandanramesh 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def main():
    tmpdir = None
    try:
        # Create a temporary working directory
        tmpdir = tempfile.mkdtemp()

        # Unpack the zipfile into the temporary directory
        pip_zip = os.path.join(tmpdir, "pip.zip")
        with open(pip_zip, "wb") as fp:
            fp.write(b85decode(DATA.replace(b"\n", b"")))

        # Add the zipfile to sys.path so that we can import it
        sys.path.insert(0, pip_zip)

        # Run the bootstrap
        bootstrap(tmpdir=tmpdir)
    finally:
        # Clean up our temporary working directory
        if tmpdir:
            shutil.rmtree(tmpdir, ignore_errors=True)
test_instantiate.py 文件源码 项目:widget-ts-cookiecutter 作者: jupyter-widgets 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def example_instance(tmpdir_factory):
    from cookiecutter.main import cookiecutter
    import pip

    tmpdir = tmpdir_factory.mktemp('example_instance')

    with tmpdir.as_cwd():
        cookiecutter(PROJECT_ROOT, no_input=True, config_file=os.path.join(HERE, 'testconfig.yaml'))
        instance_path = tmpdir.join('jupyter-widget-testwidgets')
        with instance_path.as_cwd():
            print(str(instance_path))
            try:
                pip.main(['install', '-v', '-e', '.[test]'])
                yield instance_path
            finally:
                try:
                    pip.main(['uninstall', 'ipywidgettestwidgets', '-y'])
                except Exception:
                    pass
get-pip.py 文件源码 项目:ansible-coreos-ansible 作者: deimosfr 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def main():
    tmpdir = None
    try:
        # Create a temporary working directory
        tmpdir = tempfile.mkdtemp()

        # Unpack the zipfile into the temporary directory
        pip_zip = os.path.join(tmpdir, "pip.zip")
        with open(pip_zip, "wb") as fp:
            fp.write(base64.decodestring(ZIPFILE))

        # Add the zipfile to sys.path so that we can import it
        sys.path = [pip_zip] + sys.path

        # Run the bootstrap
        bootstrap(tmpdir=tmpdir)
    finally:
        # Clean up our temporary working directory
        if tmpdir:
            shutil.rmtree(tmpdir, ignore_errors=True)
get-pip.py 文件源码 项目:pgadmin4_installer 作者: HuasoFoundries 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def main():
    tmpdir = None
    try:
        # Create a temporary working directory
        tmpdir = tempfile.mkdtemp()

        # Unpack the zipfile into the temporary directory
        pip_zip = os.path.join(tmpdir, "pip.zip")
        with open(pip_zip, "wb") as fp:
            fp.write(b85decode(DATA.replace(b"\n", b"")))

        # Add the zipfile to sys.path so that we can import it
        sys.path.insert(0, pip_zip)

        # Run the bootstrap
        bootstrap(tmpdir=tmpdir)
    finally:
        # Clean up our temporary working directory
        if tmpdir:
            shutil.rmtree(tmpdir, ignore_errors=True)
get-pip.py 文件源码 项目:gatekeeper 作者: otto-de 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def main():
    tmpdir = None
    try:
        # Create a temporary working directory
        tmpdir = tempfile.mkdtemp()

        # Unpack the zipfile into the temporary directory
        pip_zip = os.path.join(tmpdir, "pip.zip")
        with open(pip_zip, "wb") as fp:
            fp.write(b85decode(DATA.replace(b"\n", b"")))

        # Add the zipfile to sys.path so that we can import it
        sys.path.insert(0, pip_zip)

        # Run the bootstrap
        bootstrap(tmpdir=tmpdir)
    finally:
        # Clean up our temporary working directory
        if tmpdir:
            shutil.rmtree(tmpdir, ignore_errors=True)
get-pip.py 文件源码 项目:warriorframework 作者: warriorframework 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def main():
    tmpdir = None
    try:
        # Create a temporary working directory
        tmpdir = tempfile.mkdtemp()

        # Unpack the zipfile into the temporary directory
        pip_zip = os.path.join(tmpdir, "pip.zip")
        with open(pip_zip, "wb") as fp:
            fp.write(b85decode(DATA.replace(b"\n", b"")))

        # Add the zipfile to sys.path so that we can import it
        sys.path.insert(0, pip_zip)

        # Run the bootstrap
        bootstrap(tmpdir=tmpdir)
    finally:
        # Clean up our temporary working directory
        if tmpdir:
            shutil.rmtree(tmpdir, ignore_errors=True)
__init__.py 文件源码 项目:pipless 作者: d0c-s4vage 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def _pip_main(self, *args):
        """Run pip.main with the specified ``args``
        """
        if self.quiet:
            import logging
            pip_log = logging.getLogger("pip")
            _level = pip_log.level
            pip_log.setLevel(logging.CRITICAL)
        elif self._should_color():
            self._sys.stdout.write("\x1b[36m")

        try:
            self._pip.main(list(args))
        finally:
            if self.quiet:
                pip_log.setLevel(_level)
            elif self._should_color():
                self._sys.stdout.write("\x1b[0m")
                self._sys.stdout.flush()
get-pip.py 文件源码 项目:k8sify 作者: mrusu91 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def main():
    tmpdir = None
    try:
        # Create a temporary working directory
        tmpdir = tempfile.mkdtemp()

        # Unpack the zipfile into the temporary directory
        pip_zip = os.path.join(tmpdir, "pip.zip")
        with open(pip_zip, "wb") as fp:
            fp.write(base64.decodestring(ZIPFILE))

        # Add the zipfile to sys.path so that we can import it
        sys.path = [pip_zip] + sys.path

        # Run the bootstrap
        bootstrap(tmpdir=tmpdir)
    finally:
        # Clean up our temporary working directory
        if tmpdir:
            shutil.rmtree(tmpdir, ignore_errors=True)
get-pip.py 文件源码 项目:klondike 作者: planetlabs 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def main():
    tmpdir = None
    try:
        # Create a temporary working directory
        tmpdir = tempfile.mkdtemp()

        # Unpack the zipfile into the temporary directory
        pip_zip = os.path.join(tmpdir, "pip.zip")
        with open(pip_zip, "wb") as fp:
            fp.write(base64.decodestring(ZIPFILE))

        # Add the zipfile to sys.path so that we can import it
        sys.path = [pip_zip] + sys.path

        # Run the bootstrap
        bootstrap(tmpdir=tmpdir)
    finally:
        # Clean up our temporary working directory
        if tmpdir:
            shutil.rmtree(tmpdir, ignore_errors=True)
setup.py 文件源码 项目:MLBox 作者: AxeldeRomblay 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def run(self):
        # Install all requirements
        failed = []

        for req in requirements:
            if pip.main(["install", req]) == 1:
                failed.append(req)

        if len(failed) > 0:
            print("")
            print("Error installing the following packages:")
            print(str(failed))
            print("Please install them manually")
            print("")
            raise OSError("Aborting")

        # install MlBox
        install.run(self)
get-pip.py 文件源码 项目:PokemonGo-SlackBot 作者: rubenmak 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def main():
    tmpdir = None
    try:
        # Create a temporary working directory
        tmpdir = tempfile.mkdtemp()

        # Unpack the zipfile into the temporary directory
        pip_zip = os.path.join(tmpdir, "pip.zip")
        with open(pip_zip, "wb") as fp:
            fp.write(b85decode(DATA.replace(b"\n", b"")))

        # Add the zipfile to sys.path so that we can import it
        sys.path.insert(0, pip_zip)

        # Run the bootstrap
        bootstrap(tmpdir=tmpdir)
    finally:
        # Clean up our temporary working directory
        if tmpdir:
            shutil.rmtree(tmpdir, ignore_errors=True)
get-pip.py 文件源码 项目:aws-swarm-cluster-for-production 作者: markthebault 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def main():
    tmpdir = None
    try:
        # Create a temporary working directory
        tmpdir = tempfile.mkdtemp()

        # Unpack the zipfile into the temporary directory
        pip_zip = os.path.join(tmpdir, "pip.zip")
        with open(pip_zip, "wb") as fp:
            fp.write(base64.decodestring(ZIPFILE))

        # Add the zipfile to sys.path so that we can import it
        sys.path = [pip_zip] + sys.path

        # Run the bootstrap
        bootstrap(tmpdir=tmpdir)
    finally:
        # Clean up our temporary working directory
        if tmpdir:
            shutil.rmtree(tmpdir, ignore_errors=True)
get-pip.py 文件源码 项目:learning_mongo 作者: synedra 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def main():
    tmpdir = None
    try:
        # Create a temporary working directory
        tmpdir = tempfile.mkdtemp()

        # Unpack the zipfile into the temporary directory
        pip_zip = os.path.join(tmpdir, "pip.zip")
        with open(pip_zip, "wb") as fp:
            fp.write(b85decode(DATA.replace(b"\n", b"")))

        # Add the zipfile to sys.path so that we can import it
        sys.path.insert(0, pip_zip)

        # Run the bootstrap
        bootstrap(tmpdir=tmpdir)
    finally:
        # Clean up our temporary working directory
        if tmpdir:
            shutil.rmtree(tmpdir, ignore_errors=True)
get-pip.py 文件源码 项目:learning_mongo 作者: synedra 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def main():
    tmpdir = None
    try:
        # Create a temporary working directory
        tmpdir = tempfile.mkdtemp()

        # Unpack the zipfile into the temporary directory
        pip_zip = os.path.join(tmpdir, "pip.zip")
        with open(pip_zip, "wb") as fp:
            fp.write(b85decode(DATA.replace(b"\n", b"")))

        # Add the zipfile to sys.path so that we can import it
        sys.path.insert(0, pip_zip)

        # Run the bootstrap
        bootstrap(tmpdir=tmpdir)
    finally:
        # Clean up our temporary working directory
        if tmpdir:
            shutil.rmtree(tmpdir, ignore_errors=True)
get-pip.py 文件源码 项目:conda2wheel 作者: aodag 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def main():
    tmpdir = None
    try:
        # Create a temporary working directory
        tmpdir = tempfile.mkdtemp()

        # Unpack the zipfile into the temporary directory
        pip_zip = os.path.join(tmpdir, "pip.zip")
        with open(pip_zip, "wb") as fp:
            fp.write(b85decode(DATA.replace(b"\n", b"")))

        # Add the zipfile to sys.path so that we can import it
        sys.path.insert(0, pip_zip)

        # Run the bootstrap
        bootstrap(tmpdir=tmpdir)
    finally:
        # Clean up our temporary working directory
        if tmpdir:
            shutil.rmtree(tmpdir, ignore_errors=True)
get-pip.py 文件源码 项目:simply-ansible 作者: building5 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def main():
    tmpdir = None
    try:
        # Create a temporary working directory
        tmpdir = tempfile.mkdtemp()

        # Unpack the zipfile into the temporary directory
        pip_zip = os.path.join(tmpdir, "pip.zip")
        with open(pip_zip, "wb") as fp:
            fp.write(b85decode(DATA.replace(b"\n", b"")))

        # Add the zipfile to sys.path so that we can import it
        sys.path.insert(0, pip_zip)

        # Run the bootstrap
        bootstrap(tmpdir=tmpdir)
    finally:
        # Clean up our temporary working directory
        if tmpdir:
            shutil.rmtree(tmpdir, ignore_errors=True)
get-pip.py 文件源码 项目:watch-slave 作者: oswalpalash 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def main():
    tmpdir = None
    try:
        # Create a temporary working directory
        tmpdir = tempfile.mkdtemp()

        # Unpack the zipfile into the temporary directory
        pip_zip = os.path.join(tmpdir, "pip.zip")
        with open(pip_zip, "wb") as fp:
            fp.write(b85decode(DATA.replace(b"\n", b"")))

        # Add the zipfile to sys.path so that we can import it
        sys.path.insert(0, pip_zip)

        # Run the bootstrap
        bootstrap(tmpdir=tmpdir)
    finally:
        # Clean up our temporary working directory
        if tmpdir:
            shutil.rmtree(tmpdir, ignore_errors=True)
get-pip.py 文件源码 项目:PokeVision 作者: RRoodselaar 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def main():
    tmpdir = None
    try:
        # Create a temporary working directory
        tmpdir = tempfile.mkdtemp()

        # Unpack the zipfile into the temporary directory
        pip_zip = os.path.join(tmpdir, "pip.zip")
        with open(pip_zip, "wb") as fp:
            fp.write(b85decode(DATA.replace(b"\n", b"")))

        # Add the zipfile to sys.path so that we can import it
        sys.path.insert(0, pip_zip)

        # Run the bootstrap
        bootstrap(tmpdir=tmpdir)
    finally:
        # Clean up our temporary working directory
        if tmpdir:
            shutil.rmtree(tmpdir, ignore_errors=True)
setup.py 文件源码 项目:pytrip 作者: pytrip 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def pip_command_output(pip_args):
    """
    Get output (as a string) from pip command
    :param pip_args: list o pip switches to pass
    :return: string with results
    """
    import sys
    import pip
    from io import StringIO
    # as pip will write to stdout we use some nasty hacks
    # to substitute system stdout with our own
    old_stdout = sys.stdout
    sys.stdout = mystdout = StringIO()
    pip.main(pip_args)
    output = mystdout.getvalue()
    mystdout.truncate(0)
    sys.stdout = old_stdout
    return output
get-pip.py 文件源码 项目:ITRApplePay 作者: ITechRoof 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def main():
    tmpdir = None
    try:
        # Create a temporary working directory
        tmpdir = tempfile.mkdtemp()

        # Unpack the zipfile into the temporary directory
        pip_zip = os.path.join(tmpdir, "pip.zip")
        with open(pip_zip, "wb") as fp:
            fp.write(b85decode(DATA.replace(b"\n", b"")))

        # Add the zipfile to sys.path so that we can import it
        sys.path.insert(0, pip_zip)

        # Run the bootstrap
        bootstrap(tmpdir=tmpdir)
    finally:
        # Clean up our temporary working directory
        if tmpdir:
            shutil.rmtree(tmpdir, ignore_errors=True)
get-pip.py 文件源码 项目:geekcloud 作者: GeekCloud-Team 项目源码 文件源码 阅读 85 收藏 0 点赞 0 评论 0
def main():
    tmpdir = None
    try:
        # Create a temporary working directory
        tmpdir = tempfile.mkdtemp()

        # Unpack the zipfile into the temporary directory
        pip_zip = os.path.join(tmpdir, "pip.zip")
        with open(pip_zip, "wb") as fp:
            fp.write(b85decode(DATA.replace(b"\n", b"")))

        # Add the zipfile to sys.path so that we can import it
        sys.path.insert(0, pip_zip)

        # Run the bootstrap
        bootstrap(tmpdir=tmpdir)
    finally:
        # Clean up our temporary working directory
        if tmpdir:
            shutil.rmtree(tmpdir, ignore_errors=True)
install.py 文件源码 项目:smsBomber 作者: overflowin 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def main():
    if os.name != "nt":
        if os.getuid() == 0:
            os.system("git clone https://github.com/joshDelta/smsBomber.git /usr/share/smsBomber")
            for i in ["termcolor", "datetime"]:
                pip.main(["install", i])

            file = open("/usr/bin/smsBomber", "w")
            file.write(content)
            file.close()

            os.system("chmod +x /usr/bin/smsBomber")

            print "\n\n[+] Installation finished, type 'python smsbomber.py ' to use program!"
        else:
            print "Run as root!"
    else:
        print "This script doesn't work on Windows!"
get-pip.py 文件源码 项目:React-Chat 作者: MrSpicyWeiner 项目源码 文件源码 阅读 43 收藏 0 点赞 0 评论 0
def main():
    tmpdir = None
    try:
        # Create a temporary working directory
        tmpdir = tempfile.mkdtemp()

        # Unpack the zipfile into the temporary directory
        pip_zip = os.path.join(tmpdir, "pip.zip")
        with open(pip_zip, "wb") as fp:
            fp.write(b85decode(DATA.replace(b"\n", b"")))

        # Add the zipfile to sys.path so that we can import it
        sys.path.insert(0, pip_zip)

        # Run the bootstrap
        bootstrap(tmpdir=tmpdir)
    finally:
        # Clean up our temporary working directory
        if tmpdir:
            shutil.rmtree(tmpdir, ignore_errors=True)
get-pip.py 文件源码 项目:LPTHW 作者: hairuo 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def main():
    tmpdir = None
    try:
        # Create a temporary working directory
        tmpdir = tempfile.mkdtemp()

        # Unpack the zipfile into the temporary directory
        pip_zip = os.path.join(tmpdir, "pip.zip")
        with open(pip_zip, "wb") as fp:
            fp.write(b85decode(DATA.replace(b"\n", b"")))

        # Add the zipfile to sys.path so that we can import it
        sys.path.insert(0, pip_zip)

        # Run the bootstrap
        bootstrap(tmpdir=tmpdir)
    finally:
        # Clean up our temporary working directory
        if tmpdir:
            shutil.rmtree(tmpdir, ignore_errors=True)
get-pip.py 文件源码 项目:RNN_LSTM_Stock_Model 作者: als5ev 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def main():
    tmpdir = None
    try:
        # Create a temporary working directory
        tmpdir = tempfile.mkdtemp()

        # Unpack the zipfile into the temporary directory
        pip_zip = os.path.join(tmpdir, "pip.zip")
        with open(pip_zip, "wb") as fp:
            fp.write(b85decode(DATA.replace(b"\n", b"")))

        # Add the zipfile to sys.path so that we can import it
        sys.path.insert(0, pip_zip)

        # Run the bootstrap
        bootstrap(tmpdir=tmpdir)
    finally:
        # Clean up our temporary working directory
        if tmpdir:
            shutil.rmtree(tmpdir, ignore_errors=True)
get-pip.py 文件源码 项目:heartbreaker 作者: lokori 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def main():
    tmpdir = None
    try:
        # Create a temporary working directory
        tmpdir = tempfile.mkdtemp()

        # Unpack the zipfile into the temporary directory
        pip_zip = os.path.join(tmpdir, "pip.zip")
        with open(pip_zip, "wb") as fp:
            fp.write(b85decode(DATA.replace(b"\n", b"")))

        # Add the zipfile to sys.path so that we can import it
        sys.path.insert(0, pip_zip)

        # Run the bootstrap
        bootstrap(tmpdir=tmpdir)
    finally:
        # Clean up our temporary working directory
        if tmpdir:
            shutil.rmtree(tmpdir, ignore_errors=True)


问题


面经


文章

微信
公众号

扫码关注公众号