1
0
mirror of https://github.com/pypiserver/pypiserver synced 2025-02-22 19:19:37 +01:00

Added authentication by pam and fixed some pep8 complaints

This commit is contained in:
Craig Davis 2016-06-16 08:14:56 -05:00
parent 0e3da62a5b
commit c652891523

@ -91,6 +91,10 @@ def auth_by_htpasswd_file(htPsswdFile, username, password):
return htPsswdFile.check_password(username, password)
def auth_by_pam(username, password):
import pam
return pam.authenticate(username, password)
mimetypes.add_type("application/octet-stream", ".egg")
mimetypes.add_type("application/octet-stream", ".whl")
@ -140,7 +144,7 @@ wheel_file_re = re.compile(
re.VERBOSE)
_pkgname_re = re.compile(r'-\d+[a-z_.!+]', re.I)
_pkgname_parts_re = re.compile(
r"[\.\-](?=cp\d|py\d|macosx|linux|sunos|solaris|irix|aix|cygwin|win)",
r"[\.\-](?=cp\d|py\d|macosx|linux|sunos|solaris|irix|aix|cygwin|win)",
re.I)
@ -214,7 +218,7 @@ class PkgFile(object):
def __repr__(self):
return "%s(%s)" % (
self.__class__.__name__,
", ".join(["%s=%r" % (k, getattr(self, k))
", ".join(["%s=%r" % (k, getattr(self, k))
for k in sorted(self.__slots__)]))
def hash(self, hash_algo):
@ -250,6 +254,7 @@ try:
except ImportError:
listdir = _listdir
def find_packages(pkgs, prefix=""):
prefix = normalize_pkgname(prefix)
for x in pkgs:
@ -275,7 +280,7 @@ def exists(root, filename):
def store(root, filename, save_method):
assert "/" not in filename
dest_fn = os.path.join(root, filename)
save_method(dest_fn, overwrite=True) # Overwite check earlier.
save_method(dest_fn, overwrite=True) # Overwite check earlier.
def digest_file(fpath, hash_algo):