Skip to content

Commit 8b8c82d

Browse files
committed
Adjust release scriptts
Signed-off-by: Philippe Ombredanne <[email protected]>
1 parent 8b2bdf8 commit 8b8c82d

File tree

3 files changed

+38
-25
lines changed

3 files changed

+38
-25
lines changed

etc/release/scancode-create-release.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ function clean_egg_info {
222222

223223

224224
function clean_build {
225-
rm -rf build dist thirdparty PYTHON_EXECUTABLE SCANCODE_DEV_MODE
225+
rm -rf build dist thirdparty PYTHON_EXECUTABLE
226226
clean_egg_info
227227
}
228228

@@ -368,7 +368,7 @@ fi
368368

369369

370370
# wheels
371-
#build_wheels
371+
build_wheels
372372

373373
# build the app combos on the current App Python
374374
for operating_system in $OPERATING_SYSTEMS

etc/scripts/fetch_thirdparty.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
import utils_thirdparty
1919
import utils_requirements
2020

21-
TRACE = True
21+
TRACE = False
22+
TRACE_DEEP = False
2223

2324

2425
@click.command()
@@ -204,7 +205,7 @@ def fetch_thirdparty(
204205
existing_wheels = None
205206

206207
if existing_wheels:
207-
if TRACE:
208+
if TRACE_DEEP:
208209
print(
209210
f"====> Wheels already available: {name}=={version} on: {environment}: {existing_package.wheels!r}"
210211
)
@@ -213,7 +214,7 @@ def fetch_thirdparty(
213214
else:
214215
continue
215216

216-
if TRACE:
217+
if TRACE_DEEP:
217218
print(f"Fetching wheel for: {name}=={version} on: {environment}")
218219

219220
try:

etc/scripts/utils_thirdparty.py

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
# See https://github.com/nexB/skeleton for support or download.
99
# See https://aboutcode.org for more information about nexB OSS projects.
1010
#
11-
from collections import defaultdict
1211
import email
12+
import functools
1313
import itertools
1414
import os
1515
import re
@@ -18,6 +18,8 @@
1818
import tempfile
1919
import time
2020
import urllib
21+
from collections import defaultdict
22+
from urllib.parse import quote_plus
2123

2224
import attr
2325
import license_expression
@@ -29,7 +31,6 @@
2931
from commoncode.text import python_safe_name
3032
from packaging import tags as packaging_tags
3133
from packaging import version as packaging_version
32-
from urllib.parse import quote_plus
3334

3435
import utils_pip_compatibility_tags
3536
from utils_requirements import load_requirements
@@ -111,8 +112,8 @@
111112
112113
"""
113114

114-
TRACE = True
115-
TRACE_DEEP = True
115+
TRACE = False
116+
TRACE_DEEP = False
116117
TRACE_ULTRA_DEEP = False
117118

118119
# Supported environments
@@ -311,6 +312,7 @@ def download_sdist(
311312
raise DistributionNotFound(f"Failed to fetch sdist: {name}=={version}: No sources found")
312313

313314

315+
@functools.cache
314316
def get_package_versions(
315317
name,
316318
version=None,
@@ -321,15 +323,28 @@ def get_package_versions(
321323
repository ``index_urls`` list of URLs.
322324
If ``version`` is not provided, return the latest available versions.
323325
"""
326+
found = []
327+
not_found = []
324328
for index_url in index_urls:
325329
try:
326330
repo = get_pypi_repo(index_url)
327331
package = repo.get_package(name, version)
332+
328333
if package:
329-
yield package
334+
found.append((package, index_url))
335+
else:
336+
not_found.append((name, version, index_url))
330337
except RemoteNotFetchedException as e:
331-
print(f"Failed to fetch PyPI package {name} @ {version} info from {index_url}: {e}")
338+
if TRACE_ULTRA_DEEP:
339+
print(f"Failed to fetch PyPI package {name} @ {version} info from {index_url}: {e}")
340+
not_found.append((name, version, index_url))
332341

342+
if not found:
343+
raise Exception(f"No PyPI package {name} @ {version} found!")
344+
345+
for package, index_url in found:
346+
print(f"Fetched PyPI package {package.name} @ {package.version} info from {index_url}")
347+
yield package
333348

334349
################################################################################
335350
#
@@ -553,7 +568,7 @@ def get_best_download_url(
553568
)
554569
if pypi_package:
555570
if isinstance(pypi_package, tuple):
556-
raise Exception("############", repr(pypi_package))
571+
raise Exception("############", repr(pypi_package), self.normalized_name, self.version, index_url)
557572
try:
558573
pypi_url = pypi_package.get_url_for_filename(self.filename)
559574
except Exception as e:
@@ -1450,7 +1465,7 @@ def get_name_version(cls, name, version, packages):
14501465
nvs = [p for p in cls.get_versions(name, packages) if p.version == version]
14511466

14521467
if not nvs:
1453-
return name, version
1468+
return
14541469

14551470
if len(nvs) == 1:
14561471
return nvs[0]
@@ -1618,7 +1633,6 @@ def tags(self):
16181633
)
16191634
)
16201635

1621-
16221636
################################################################################
16231637
#
16241638
# PyPI repo and link index for package wheels and sources
@@ -1657,7 +1671,10 @@ def get_versions(self, name):
16571671
The list may be empty.
16581672
"""
16591673
name = name and NameVer.normalize_name(name)
1660-
self._populate_links_and_packages(name)
1674+
try:
1675+
self._populate_links_and_packages(name)
1676+
except Exception as e:
1677+
print(f" ==> Cannot find versions of {name}: {e}")
16611678
return self.packages_by_normalized_name.get(name, [])
16621679

16631680
def get_latest_version(self, name):
@@ -1803,7 +1820,6 @@ def from_url(cls, url=ABOUT_BASE_URL, _LINKS_REPO={}):
18031820
_LINKS_REPO[url] = cls(url=url)
18041821
return _LINKS_REPO[url]
18051822

1806-
18071823
################################################################################
18081824
# Globals for remote repos to be lazily created and cached on first use for the
18091825
# life of the session together with some convenience functions.
@@ -1824,6 +1840,7 @@ def get_pypi_repo(index_url, _PYPI_REPO={}):
18241840
return _PYPI_REPO[index_url]
18251841

18261842

1843+
@functools.cache
18271844
def get_pypi_package_data(name, version, index_url, verbose=TRACE_DEEP):
18281845
"""
18291846
Return a PypiPackage or None.
@@ -1833,13 +1850,12 @@ def get_pypi_package_data(name, version, index_url, verbose=TRACE_DEEP):
18331850
print(f" get_pypi_package_data: Fetching {name} @ {version} info from {index_url}")
18341851
package = get_pypi_repo(index_url).get_package(name, version)
18351852
if verbose:
1836-
print(f" get_pypi_package_data: Fetched")# {package}")
1853+
print(f" get_pypi_package_data: Fetched: {package}")
18371854
return package
18381855

18391856
except RemoteNotFetchedException as e:
18401857
print(f" get_pypi_package_data: Failed to fetch PyPI package {name} @ {version} info from {index_url}: {e}")
18411858

1842-
18431859
################################################################################
18441860
#
18451861
# Basic file and URL-based operations using a persistent file-based Cache
@@ -2000,7 +2016,6 @@ def fetch_and_save_path_or_url(
20002016
fo.write(content)
20012017
return content
20022018

2003-
20042019
################################################################################
20052020
# Requirements processing
20062021
################################################################################
@@ -2038,7 +2053,6 @@ def get_required_packages(
20382053
print(" get_required_packages: name:", name, "version:", version)
20392054
yield repo.get_package(name, version)
20402055

2041-
20422056
################################################################################
20432057
# Functions to update or fetch ABOUT and license files
20442058
################################################################################
@@ -2117,7 +2131,6 @@ def get_other_dists(_package, _dist):
21172131
for p in packages_by_name[local_package.name]
21182132
if p.version != local_package.version
21192133
]
2120-
21212134
other_local_version = other_local_packages and other_local_packages[-1]
21222135
if other_local_version:
21232136
latest_local_dists = list(other_local_version.get_distributions())
@@ -2189,7 +2202,6 @@ def get_other_dists(_package, _dist):
21892202
lic_errs = "\n".join(lic_errs)
21902203
print(f"Failed to fetch some licenses:: {lic_errs}")
21912204

2192-
21932205
################################################################################
21942206
#
21952207
# Functions to build new Python wheels including native on multiple OSes
@@ -2320,9 +2332,9 @@ def build_wheels_locally_if_pure_python(
23202332
"--wheel-dir",
23212333
wheel_dir,
23222334
]
2323-
+ deps
2324-
+ verbose
2325-
+ [requirements_specifier]
2335+
+deps
2336+
+verbose
2337+
+[requirements_specifier]
23262338
)
23272339

23282340
print(f"Building local wheels for: {requirements_specifier}")

0 commit comments

Comments
 (0)