Beispiel #1
0
        do_exec(co, module.__dict__)
        return sys.modules[fullname]

    def get_source(self, name):
        res = self.sources.get(name)
        if res is None:
            res = self.sources.get(name + '.__init__')
        return res


if sys.version_info >= (3, 0):
    import pickle
    exec("def do_exec(co, loc): exec(co, loc)\n")
    sources = sources.encode("ascii")  # ensure bytes
    d = zlib.decompress(base64.decodebytes(sources))
    sources = pickle.loads(zlib.decompress(base64.decodebytes(sources)),
                           encoding="utf-8")
else:
    import cPickle as pickle
    exec("def do_exec(co, loc): exec co in loc\n")
    sources = pickle.loads(zlib.decompress(base64.decodestring(sources)))

importer = DictImporter()
importer.sources = sources
sys.meta_path.append(importer)

if __name__ == "__main__":
    from pypiserver import core
    core.DEFAULT_SERVER = "waitress"
    core.main()
Beispiel #2
0
 def __call__(self, argv):
     sys.stdout.write("Running %s\n" % (argv, ))
     core.main(["pypi-server"] + argv)
     return self.run_kwargs
Beispiel #3
0
 def __call__(self, argv):
     print "Running", argv
     core.main(["pypi-server"] + argv)
     return self.run_kwargs
Beispiel #4
0
 def __call__(self, argv):
     sys.stdout.write("Running %s\n" % (argv,))
     core.main(["pypi-server"] + argv)
     return self.run_kwargs
Beispiel #5
0
 def __call__(self, argv):
     print "Running", argv
     core.main(["pypi-server"] + argv)
     return self.run_kwargs
Beispiel #6
0
            module.__path__ = [fullname]

        do_exec(co, module.__dict__)
        return sys.modules[fullname]

    def get_source(self, name):
        res = self.sources.get(name)
        if res is None:
            res = self.sources.get(name + '.__init__')
        return res


if sys.version_info >= (3, 0):
    import pickle
    exec("def do_exec(co, loc): exec(co, loc)\n")
    sources = sources.encode("ascii")  # ensure bytes
    d = zlib.decompress(base64.decodebytes(sources))
    sources = pickle.loads(zlib.decompress(base64.decodebytes(sources)), encoding="utf-8")
else:
    import cPickle as pickle
    exec("def do_exec(co, loc): exec co in loc\n")
    sources = pickle.loads(zlib.decompress(base64.decodestring(sources)))

importer = DictImporter()
importer.sources = sources
sys.meta_path.append(importer)

if __name__ == "__main__":
    from pypiserver.core import main
    main()
Beispiel #7
0
if __name__ == "__main__":
    if __package__ == "":  # running as python pypiserver-...whl/pypiserver?
        import sys, os
        sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
    from pypiserver import core
    core.main()