@@ -311,6 +311,7 @@ def download_sdist(name, version, dest_dir=THIRDPARTY_DIR, repos=tuple()):
311311
312312 return fetched_sdist_filename
313313
314+
314315################################################################################
315316#
316317# Core models
@@ -1064,16 +1065,16 @@ def get_sdist_name_ver_ext(filename):
10641065 if version .isalpha ():
10651066 return False
10661067
1067- # non-pep 440 version
1068+ # non-pep 440 version
10681069 if "-" in version :
10691070 return False
10701071
1071- # single version
1072+ # single version
10721073 if version .isdigit () and len (version ) == 1 :
10731074 return False
10741075
1075- # r1 version
1076- if len (version ) == 2 and version [0 ]== "r" and version [1 ].isdigit ():
1076+ # r1 version
1077+ if len (version ) == 2 and version [0 ] == "r" and version [1 ].isdigit ():
10771078 return False
10781079
10791080 # dotless version (but calver is OK)
@@ -1588,6 +1589,7 @@ def tags(self):
15881589 )
15891590 )
15901591
1592+
15911593################################################################################
15921594#
15931595# PyPI repo and link index for package wheels and sources
@@ -1629,7 +1631,9 @@ class PypiSimpleRepository:
16291631 use_cached_index = attr .ib (
16301632 type = bool ,
16311633 default = False ,
1632- metadata = dict (help = "If True, use any existing on-disk cached PyPI index files. Otherwise, fetch and cache." ),
1634+ metadata = dict (
1635+ help = "If True, use any existing on-disk cached PyPI index files. Otherwise, fetch and cache."
1636+ ),
16331637 )
16341638
16351639 def _get_package_versions_map (self , name ):
@@ -1674,6 +1678,7 @@ def get_package_version(self, name, version=None):
16741678 """
16751679 if not version :
16761680 versions = list (self ._get_package_versions_map (name ).values ())
1681+ # return the latest version
16771682 return versions and versions [- 1 ]
16781683 else :
16791684 return self ._get_package_versions_map (name ).get (version )
@@ -1724,7 +1729,9 @@ class LinksRepository:
17241729 use_cached_index = attr .ib (
17251730 type = bool ,
17261731 default = False ,
1727- metadata = dict (help = "If True, use any existing on-disk cached index files. Otherwise, fetch and cache." ),
1732+ metadata = dict (
1733+ help = "If True, use any existing on-disk cached index files. Otherwise, fetch and cache."
1734+ ),
17281735 )
17291736
17301737 def __attrs_post_init__ (self ):
@@ -1790,6 +1797,7 @@ def from_url(cls, url=ABOUT_BASE_URL, _LINKS_REPO={}, use_cached_index=False):
17901797 _LINKS_REPO [url ] = cls (url = url , use_cached_index = use_cached_index )
17911798 return _LINKS_REPO [url ]
17921799
1800+
17931801################################################################################
17941802# Globals for remote repos to be lazily created and cached on first use for the
17951803# life of the session together with some convenience functions.
@@ -1803,6 +1811,7 @@ def get_local_packages(directory=THIRDPARTY_DIR):
18031811 """
18041812 return list (PypiPackage .packages_from_dir (directory = directory ))
18051813
1814+
18061815################################################################################
18071816#
18081817# Basic file and URL-based operations using a persistent file-based Cache
@@ -1953,6 +1962,7 @@ def fetch_and_save(
19531962 fo .write (content )
19541963 return content
19551964
1965+
19561966################################################################################
19571967#
19581968# Functions to update or fetch ABOUT and license files
@@ -2051,7 +2061,9 @@ def get_other_dists(_package, _dist):
20512061 # if has key data we may look to improve later, but we can move on
20522062 if local_dist .has_key_metadata ():
20532063 local_dist .save_about_and_notice_files (dest_dir = dest_dir )
2054- local_dist .fetch_license_files (dest_dir = dest_dir , use_cached_index = use_cached_index )
2064+ local_dist .fetch_license_files (
2065+ dest_dir = dest_dir , use_cached_index = use_cached_index
2066+ )
20552067 continue
20562068
20572069 # lets try to fetch remotely
@@ -2089,7 +2101,9 @@ def get_other_dists(_package, _dist):
20892101 # if has key data we may look to improve later, but we can move on
20902102 if local_dist .has_key_metadata ():
20912103 local_dist .save_about_and_notice_files (dest_dir = dest_dir )
2092- local_dist .fetch_license_files (dest_dir = dest_dir , use_cached_index = use_cached_index )
2104+ local_dist .fetch_license_files (
2105+ dest_dir = dest_dir , use_cached_index = use_cached_index
2106+ )
20932107 continue
20942108
20952109 # try to get data from pkginfo (no license though)
@@ -2107,6 +2121,7 @@ def get_other_dists(_package, _dist):
21072121 lic_errs = "\n " .join (lic_errs )
21082122 print (f"Failed to fetch some licenses:: { lic_errs } " )
21092123
2124+
21102125################################################################################
21112126#
21122127# Functions to build new Python wheels including native on multiple OSes
@@ -2210,6 +2225,7 @@ def download_wheels_with_pip(
22102225 downloaded = existing ^ set (os .listdir (dest_dir ))
22112226 return sorted (downloaded ), error
22122227
2228+
22132229################################################################################
22142230#
22152231# Functions to check for problems
0 commit comments