mirror of
https://github.com/pypiserver/pypiserver
synced 2024-11-09 16:45:51 +01:00
make pypiserver run on python 3.x
unfortunately the tests do not work, since twill isn't ported yet.
This commit is contained in:
parent
1b2bb1a924
commit
1866a7ad6e
@ -172,7 +172,7 @@ def bad_url(prefix):
|
|||||||
|
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
print """pypi-server [OPTIONS] [PACKAGES_DIRECTORY]
|
sys.stdout.write("""pypi-server [OPTIONS] [PACKAGES_DIRECTORY]
|
||||||
start PyPI compatible package server serving packages from
|
start PyPI compatible package server serving packages from
|
||||||
PACKAGES_DIRECTORY. If PACKAGES_DIRECTORY is not given on the
|
PACKAGES_DIRECTORY. If PACKAGES_DIRECTORY is not given on the
|
||||||
command line, it uses the default ~/packages. pypiserver scans this
|
command line, it uses the default ~/packages. pypiserver scans this
|
||||||
@ -226,7 +226,7 @@ The following additional options can be specified with -U:
|
|||||||
allow updating to unstable version (alpha, beta, rc, dev versions)
|
allow updating to unstable version (alpha, beta, rc, dev versions)
|
||||||
|
|
||||||
Visit http://pypi.python.org/pypi/pypiserver for more information.
|
Visit http://pypi.python.org/pypi/pypiserver for more information.
|
||||||
"""
|
""")
|
||||||
|
|
||||||
|
|
||||||
def main(argv=None):
|
def main(argv=None):
|
||||||
@ -262,7 +262,7 @@ def main(argv=None):
|
|||||||
sys.exit("unknown server %r. choose one of %s" % (v, ", ".join(server_names.keys())))
|
sys.exit("unknown server %r. choose one of %s" % (v, ", ".join(server_names.keys())))
|
||||||
server = v
|
server = v
|
||||||
elif k == "--version":
|
elif k == "--version":
|
||||||
print "pypiserver %s" % __version__
|
sys.stdout.write("pypiserver %s\n" % __version__)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
elif k == "-U":
|
elif k == "-U":
|
||||||
command = "update"
|
command = "update"
|
||||||
@ -297,8 +297,7 @@ def main(argv=None):
|
|||||||
|
|
||||||
server = server or "auto"
|
server = server or "auto"
|
||||||
debug(True)
|
debug(True)
|
||||||
print "This is pypiserver %s serving %r on %s:%s" % (__version__, root, host, port)
|
sys.stdout.write("This is pypiserver %s serving %r on %s:%s\n\n" % (__version__, root, host, port))
|
||||||
print
|
|
||||||
run(host=host, port=port, server=server)
|
run(host=host, port=port, server=server)
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ def find_updates(pkgset, stable_only=True):
|
|||||||
|
|
||||||
need_update = []
|
need_update = []
|
||||||
|
|
||||||
print "checking %s packages for newer version" % len(pkgname2latest),
|
sys.stdout.write("checking %s packages for newer version\n" % len(pkgname2latest),)
|
||||||
for count, (pkgname, file) in enumerate(pkgname2latest.items()):
|
for count, (pkgname, file) in enumerate(pkgname2latest.items()):
|
||||||
if count % 40 == 0:
|
if count % 40 == 0:
|
||||||
write("\n")
|
write("\n")
|
||||||
@ -76,21 +76,20 @@ def find_updates(pkgset, stable_only=True):
|
|||||||
|
|
||||||
no_releases = list(no_releases)
|
no_releases = list(no_releases)
|
||||||
no_releases.sort()
|
no_releases.sort()
|
||||||
print "no releases found on pypi for", ", ".join(no_releases)
|
sys.stdout.write("no releases found on pypi for " + ", ".join(no_releases) + "\n\n")
|
||||||
print
|
|
||||||
return need_update
|
return need_update
|
||||||
|
|
||||||
|
|
||||||
def update(pkgset, destdir=None, dry_run=False, stable_only=True):
|
def update(pkgset, destdir=None, dry_run=False, stable_only=True):
|
||||||
need_update = find_updates(pkgset, stable_only=stable_only)
|
need_update = find_updates(pkgset, stable_only=stable_only)
|
||||||
for x in need_update:
|
for x in need_update:
|
||||||
print "# update", x.pkgname, "from", x.version, "to", x.latest_version
|
sys.stdout.write("# update " + x.pkgname + " from " + x.version + "to" + x.latest_version + "\n")
|
||||||
|
|
||||||
cmd = ["pip", "-q", "install", "-i", "http://pypi.python.org/simple",
|
cmd = ["pip", "-q", "install", "-i", "http://pypi.python.org/simple",
|
||||||
"-d", destdir or os.path.dirname(os.path.join(pkgset.root, x.path)),
|
"-d", destdir or os.path.dirname(os.path.join(pkgset.root, x.path)),
|
||||||
"%s==%s" % (x.pkgname, x.latest_version)]
|
"%s==%s" % (x.pkgname, x.latest_version)]
|
||||||
print " ".join(cmd)
|
|
||||||
print
|
sys.stdout.write(" ".join(cmd) + "\n\n")
|
||||||
if not dry_run:
|
if not dry_run:
|
||||||
os.spawnlp(os.P_WAIT, cmd[0], *cmd)
|
os.spawnlp(os.P_WAIT, cmd[0], *cmd)
|
||||||
|
|
||||||
|
23
setup.py
23
setup.py
@ -1,13 +1,27 @@
|
|||||||
#! /usr/bin/env python
|
#! /usr/bin/env python
|
||||||
|
|
||||||
import os
|
import sys, os
|
||||||
from distutils.core import setup
|
extrakw = {}
|
||||||
|
|
||||||
|
try:
|
||||||
|
from setuptools import setup
|
||||||
|
extrakw["use_2to3"] = True
|
||||||
|
except ImportError:
|
||||||
|
if sys.version_info >= (3, 0):
|
||||||
|
raise
|
||||||
|
from distutils.core import setup
|
||||||
|
|
||||||
|
|
||||||
|
if sys.version_info >= (3, 0):
|
||||||
|
exec("def do_exec(co, loc): exec(co, loc)\n")
|
||||||
|
else:
|
||||||
|
exec("def do_exec(co, loc): exec co in loc\n")
|
||||||
|
|
||||||
|
|
||||||
def get_version():
|
def get_version():
|
||||||
d = {}
|
d = {}
|
||||||
try:
|
try:
|
||||||
execfile("pypiserver/__init__.py", d, d)
|
do_exec(open("pypiserver/__init__.py").read(), d)
|
||||||
except (ImportError, RuntimeError):
|
except (ImportError, RuntimeError):
|
||||||
pass
|
pass
|
||||||
return d["__version__"]
|
return d["__version__"]
|
||||||
@ -38,4 +52,5 @@ setup(name="pypiserver",
|
|||||||
"Programming Language :: Python :: 2.6",
|
"Programming Language :: Python :: 2.6",
|
||||||
"Programming Language :: Python :: 2.7",
|
"Programming Language :: Python :: 2.7",
|
||||||
"Topic :: Software Development :: Build Tools",
|
"Topic :: Software Development :: Build Tools",
|
||||||
"Topic :: System :: Software Distribution"])
|
"Topic :: System :: Software Distribution"],
|
||||||
|
**extrakw)
|
||||||
|
Loading…
Reference in New Issue
Block a user