forked from github.com/pypiserver
merge --index-url changes
This commit is contained in:
commit
2bcc15422b
@ -204,6 +204,10 @@ The following additional options can be specified with -U:
|
||||
-u
|
||||
allow updating to unstable version (alpha, beta, rc, dev versions)
|
||||
|
||||
--index-url INDEX_URL
|
||||
use a different pip index url while updating. The default is to use
|
||||
https://pypi.python.org/simple.
|
||||
|
||||
Visit http://pypi.python.org/pypi/pypiserver for more information.
|
||||
""")
|
||||
|
||||
@ -220,6 +224,7 @@ def main(argv=None):
|
||||
server = DEFAULT_SERVER
|
||||
redirect_to_fallback = True
|
||||
fallback_url = "http://pypi.python.org/simple"
|
||||
index_url = "http://pypi.python.org/simple"
|
||||
password_file = None
|
||||
overwrite = False
|
||||
|
||||
@ -230,6 +235,7 @@ def main(argv=None):
|
||||
try:
|
||||
opts, roots = getopt.getopt(argv[1:], "i:p:r:d:P:Uuxoh", [
|
||||
"interface=",
|
||||
"index-url=",
|
||||
"passwords=",
|
||||
"port=",
|
||||
"root=",
|
||||
@ -249,6 +255,8 @@ def main(argv=None):
|
||||
port = int(v)
|
||||
elif k in ("-i", "--interface"):
|
||||
host = v
|
||||
elif k == "--index-url":
|
||||
index_url = v
|
||||
elif k in ("-r", "--root"):
|
||||
roots.append(v)
|
||||
elif k == "--disable-fallback":
|
||||
@ -288,7 +296,7 @@ def main(argv=None):
|
||||
if command == "update":
|
||||
packages = frozenset(itertools.chain(*[listdir(r) for r in roots]))
|
||||
from pypiserver import manage
|
||||
manage.update(packages, update_directory, update_dry_run, stable_only=update_stable_only)
|
||||
manage.update(packages, update_directory, update_dry_run, stable_only=update_stable_only, index_url=index_url)
|
||||
return
|
||||
|
||||
a = app(
|
||||
|
@ -85,7 +85,7 @@ def build_releases(pkg, versions):
|
||||
replaces=pkg)
|
||||
|
||||
|
||||
def find_updates(pkgset, stable_only=True):
|
||||
def find_updates(pkgset, stable_only=True, index_url="https://pypi.python.org/pypi/"):
|
||||
no_releases = set()
|
||||
filter_releases = filter_stable_releases if stable_only else (lambda x: x)
|
||||
|
||||
@ -98,7 +98,7 @@ def find_updates(pkgset, stable_only=True):
|
||||
sys.stdout.write("checking %s packages for newer version\n" % len(latest_pkgs),)
|
||||
need_update = set()
|
||||
|
||||
pypi = make_pypi_client("https://pypi.python.org/pypi/")
|
||||
pypi = make_pypi_client(index_url)
|
||||
|
||||
for count, pkg in enumerate(latest_pkgs):
|
||||
if count % 40 == 0:
|
||||
@ -127,12 +127,12 @@ def find_updates(pkgset, stable_only=True):
|
||||
return need_update
|
||||
|
||||
|
||||
def update(pkgset, destdir=None, dry_run=False, stable_only=True):
|
||||
need_update = find_updates(pkgset, stable_only=stable_only)
|
||||
def update(pkgset, destdir=None, dry_run=False, stable_only=True, index_url="https://pypi.python.org/simple"):
|
||||
need_update = find_updates(pkgset, stable_only=stable_only, index_url=index_url)
|
||||
for pkg in sorted(need_update, key=lambda x: x.pkgname):
|
||||
sys.stdout.write("# update %s from %s to %s\n" % (pkg.pkgname, pkg.replaces.version, pkg.version))
|
||||
|
||||
cmd = ["pip", "-q", "install", "--no-deps", "-i", "https://pypi.python.org/simple",
|
||||
cmd = ["pip", "-q", "install", "--no-deps", "-i", index_url,
|
||||
"-d", destdir or os.path.dirname(pkg.replaces.fn),
|
||||
"%s==%s" % (pkg.pkgname, pkg.version)]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user