lastversion 3.4.0__tar.gz → 3.4.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {lastversion-3.4.0/lastversion.egg-info → lastversion-3.4.2}/PKG-INFO +2 -1
- {lastversion-3.4.0 → lastversion-3.4.2}/README.md +1 -0
- {lastversion-3.4.0 → lastversion-3.4.2}/lastversion/GitHubRepoSession.py +2 -2
- {lastversion-3.4.0 → lastversion-3.4.2}/lastversion/GitLabRepoSession.py +1 -1
- {lastversion-3.4.0 → lastversion-3.4.2}/lastversion/ProjectHolder.py +8 -9
- {lastversion-3.4.0 → lastversion-3.4.2}/lastversion/__about__.py +1 -1
- {lastversion-3.4.0 → lastversion-3.4.2}/lastversion/lastversion.py +31 -10
- {lastversion-3.4.0 → lastversion-3.4.2/lastversion.egg-info}/PKG-INFO +2 -1
- {lastversion-3.4.0 → lastversion-3.4.2}/tests/test_gitlab.py +9 -0
- {lastversion-3.4.0 → lastversion-3.4.2}/tests/test_hg.py +9 -0
- {lastversion-3.4.0 → lastversion-3.4.2}/LICENSE +0 -0
- {lastversion-3.4.0 → lastversion-3.4.2}/MANIFEST.in +0 -0
- {lastversion-3.4.0 → lastversion-3.4.2}/README-ZH-CN.md +0 -0
- {lastversion-3.4.0 → lastversion-3.4.2}/lastversion/BitBucketRepoSession.py +0 -0
- {lastversion-3.4.0 → lastversion-3.4.2}/lastversion/FeedRepoSession.py +0 -0
- {lastversion-3.4.0 → lastversion-3.4.2}/lastversion/GiteaRepoSession.py +0 -0
- {lastversion-3.4.0 → lastversion-3.4.2}/lastversion/HelmChartRepoSession.py +0 -0
- {lastversion-3.4.0 → lastversion-3.4.2}/lastversion/HolderFactory.py +0 -0
- {lastversion-3.4.0 → lastversion-3.4.2}/lastversion/LocalVersionSession.py +0 -0
- {lastversion-3.4.0 → lastversion-3.4.2}/lastversion/MercurialRepoSession.py +0 -0
- {lastversion-3.4.0 → lastversion-3.4.2}/lastversion/PypiRepoSession.py +0 -0
- {lastversion-3.4.0 → lastversion-3.4.2}/lastversion/SourceForgeRepoSession.py +0 -0
- {lastversion-3.4.0 → lastversion-3.4.2}/lastversion/SystemRepoSession.py +0 -0
- {lastversion-3.4.0 → lastversion-3.4.2}/lastversion/TestProjectHolder.py +0 -0
- {lastversion-3.4.0 → lastversion-3.4.2}/lastversion/Version.py +0 -0
- {lastversion-3.4.0 → lastversion-3.4.2}/lastversion/WikipediaRepoSession.py +0 -0
- {lastversion-3.4.0 → lastversion-3.4.2}/lastversion/WordPressPluginRepoSession.py +0 -0
- {lastversion-3.4.0 → lastversion-3.4.2}/lastversion/__init__.py +0 -0
- {lastversion-3.4.0 → lastversion-3.4.2}/lastversion/__main__.py +0 -0
- {lastversion-3.4.0 → lastversion-3.4.2}/lastversion/argparse_version.py +0 -0
- {lastversion-3.4.0 → lastversion-3.4.2}/lastversion/exceptions.py +0 -0
- {lastversion-3.4.0 → lastversion-3.4.2}/lastversion/spdx_id_to_rpmspec.py +0 -0
- {lastversion-3.4.0 → lastversion-3.4.2}/lastversion/utils.py +0 -0
- {lastversion-3.4.0 → lastversion-3.4.2}/lastversion.egg-info/SOURCES.txt +0 -0
- {lastversion-3.4.0 → lastversion-3.4.2}/lastversion.egg-info/dependency_links.txt +0 -0
- {lastversion-3.4.0 → lastversion-3.4.2}/lastversion.egg-info/entry_points.txt +0 -0
- {lastversion-3.4.0 → lastversion-3.4.2}/lastversion.egg-info/not-zip-safe +0 -0
- {lastversion-3.4.0 → lastversion-3.4.2}/lastversion.egg-info/requires.txt +0 -0
- {lastversion-3.4.0 → lastversion-3.4.2}/lastversion.egg-info/top_level.txt +0 -0
- {lastversion-3.4.0 → lastversion-3.4.2}/setup.cfg +0 -0
- {lastversion-3.4.0 → lastversion-3.4.2}/setup.py +0 -0
- {lastversion-3.4.0 → lastversion-3.4.2}/tests/test_cli.py +0 -0
- {lastversion-3.4.0 → lastversion-3.4.2}/tests/test_gitea.py +0 -0
- {lastversion-3.4.0 → lastversion-3.4.2}/tests/test_github.py +0 -0
- {lastversion-3.4.0 → lastversion-3.4.2}/tests/test_lastversion.py +0 -0
- {lastversion-3.4.0 → lastversion-3.4.2}/tests/test_pypi.py +0 -0
- {lastversion-3.4.0 → lastversion-3.4.2}/tests/test_sf.py +0 -0
- {lastversion-3.4.0 → lastversion-3.4.2}/tests/test_wiki.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: lastversion
|
|
3
|
-
Version: 3.4.
|
|
3
|
+
Version: 3.4.2
|
|
4
4
|
Summary: A CLI tool to find the latest stable version of an arbitrary project
|
|
5
5
|
Home-page: https://github.com/dvershinin/lastversion
|
|
6
6
|
Author: Danila Vershinin
|
|
@@ -76,6 +76,7 @@ Requires-Dist: markdown-include; extra == "build"
|
|
|
76
76
|
|
|
77
77
|
[](https://github.com/dvershinin/lastversion/actions/workflows/pythonpackage.yml)
|
|
78
78
|
[](https://badge.fury.io/py/lastversion)
|
|
79
|
+

|
|
79
80
|
[](https://lastversion.getpagespeed.com/en/latest/?badge=latest)
|
|
80
81
|
[](https://www.codacy.com/manual/GetPageSpeed/lastversion?utm_source=github.com&utm_medium=referral&utm_content=dvershinin/lastversion&utm_campaign=Badge_Grade)
|
|
81
82
|
[](https://www.codacy.com/gh/dvershinin/lastversion/dashboard?utm_source=github.com&utm_medium=referral&utm_content=dvershinin/lastversion&utm_campaign=Badge_Coverage)
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://github.com/dvershinin/lastversion/actions/workflows/pythonpackage.yml)
|
|
4
4
|
[](https://badge.fury.io/py/lastversion)
|
|
5
|
+

|
|
5
6
|
[](https://lastversion.getpagespeed.com/en/latest/?badge=latest)
|
|
6
7
|
[](https://www.codacy.com/manual/GetPageSpeed/lastversion?utm_source=github.com&utm_medium=referral&utm_content=dvershinin/lastversion&utm_campaign=Badge_Grade)
|
|
7
8
|
[](https://www.codacy.com/gh/dvershinin/lastversion/dashboard?utm_source=github.com&utm_medium=referral&utm_content=dvershinin/lastversion&utm_campaign=Badge_Coverage)
|
|
@@ -169,7 +169,7 @@ class GitHubRepoSession(ProjectHolder):
|
|
|
169
169
|
self.api_base = f"https://api.{self.DEFAULT_HOSTNAME}"
|
|
170
170
|
|
|
171
171
|
if "/" not in repo:
|
|
172
|
-
self.
|
|
172
|
+
self.repo = self.find_repo_by_name_only(repo)
|
|
173
173
|
|
|
174
174
|
def get_rate_limit_url(self):
|
|
175
175
|
return f"{self.api_base}/rate_limit"
|
|
@@ -493,7 +493,7 @@ class GitHubRepoSession(ProjectHolder):
|
|
|
493
493
|
self.repo,
|
|
494
494
|
repo_data["full_name"],
|
|
495
495
|
)
|
|
496
|
-
self.
|
|
496
|
+
self.repo = repo_data["full_name"]
|
|
497
497
|
# request the feed from the new location
|
|
498
498
|
return self.get_releases_feed_contents(rename_checked=False)
|
|
499
499
|
if r.status_code == 200:
|
|
@@ -90,7 +90,7 @@ class GitLabRepoSession(ProjectHolder):
|
|
|
90
90
|
|
|
91
91
|
def get_assets(self, release, short_urls, assets_filter=None):
|
|
92
92
|
urls = []
|
|
93
|
-
assets = release.get("assets",
|
|
93
|
+
assets = release.get("assets", {}).get("links", [])
|
|
94
94
|
arch_matched_assets = []
|
|
95
95
|
if not assets_filter and platform.machine() in ["x86_64", "AMD64"]:
|
|
96
96
|
for asset in assets:
|
|
@@ -86,10 +86,12 @@ class ProjectHolder(requests.Session):
|
|
|
86
86
|
# Instance of project holder itself uniquely identifies a project (noname)
|
|
87
87
|
REPO_IS_HOLDER = False
|
|
88
88
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
self.
|
|
89
|
+
@property
|
|
90
|
+
def name(self):
|
|
91
|
+
"""Get project name, useful in URLs for assets, etc."""
|
|
92
|
+
if self.repo:
|
|
93
|
+
return self.repo.split("/")[-1]
|
|
94
|
+
return None
|
|
93
95
|
|
|
94
96
|
def __init__(self, name=None, hostname=None):
|
|
95
97
|
super(ProjectHolder, self).__init__()
|
|
@@ -118,8 +120,6 @@ class ProjectHolder(requests.Session):
|
|
|
118
120
|
# identifies project on a given hostname
|
|
119
121
|
# normalize repo to number of meaningful parameters
|
|
120
122
|
self.repo = self.get_base_repo_from_repo_arg(name)
|
|
121
|
-
# short name for "repo", useful in URLs
|
|
122
|
-
self.name = None
|
|
123
123
|
# in some case we do not specify repo, but feed is discovered, no repo is given then
|
|
124
124
|
self.feed_url = None
|
|
125
125
|
self.even = False
|
|
@@ -375,9 +375,8 @@ class ProjectHolder(requests.Session):
|
|
|
375
375
|
def release_download_url(self, release, shorter=False):
|
|
376
376
|
"""Get release download URL."""
|
|
377
377
|
if not self.RELEASE_URL_FORMAT:
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
)
|
|
378
|
+
log.warning("Getting release URL for %s is not implemented", self._type())
|
|
379
|
+
return None
|
|
381
380
|
ext = "zip" if os.name == "nt" else "tar.gz"
|
|
382
381
|
|
|
383
382
|
fmt = (
|
|
@@ -81,6 +81,8 @@ def get_repo_data_from_spec(rpmspec_filename):
|
|
|
81
81
|
name = line.split("Name:")[1].strip()
|
|
82
82
|
elif line.startswith("URL:"):
|
|
83
83
|
spec_url = line.split("URL:")[1].strip()
|
|
84
|
+
elif line.startswith("Source0:") and not spec_url:
|
|
85
|
+
spec_url = line.split("Source0:")[1].strip()
|
|
84
86
|
elif line.startswith("%global upstream_version "):
|
|
85
87
|
current_version = shlex.split(line)[2].strip()
|
|
86
88
|
# influences %spec_tag to use %upstream_version instead of %version
|
|
@@ -91,14 +93,9 @@ def get_repo_data_from_spec(rpmspec_filename):
|
|
|
91
93
|
repo_data["only"] = shlex.split(line)[2].strip()
|
|
92
94
|
elif line.startswith("%global lastversion_having_asset"):
|
|
93
95
|
repo_data["having_asset"] = shlex.split(line)[2].strip()
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
log.warning(
|
|
98
|
-
"Neither %upstream_github nor %lastversion_repo macros were found. "
|
|
99
|
-
"Please prepare your spec file using instructions: "
|
|
100
|
-
"https://lastversion.getpagespeed.com/spec-preparing.html"
|
|
101
|
-
)
|
|
96
|
+
elif line.startswith("%global lastversion_major"):
|
|
97
|
+
repo_data["major"] = shlex.split(line)[2].strip()
|
|
98
|
+
|
|
102
99
|
if not current_version:
|
|
103
100
|
log.critical(
|
|
104
101
|
"Did not find neither Version: nor %upstream_version in the spec file"
|
|
@@ -230,7 +227,7 @@ def latest(
|
|
|
230
227
|
project.set_exclude(exclude)
|
|
231
228
|
project.set_having_asset(repo_data.get("having_asset", having_asset))
|
|
232
229
|
project.set_even(even)
|
|
233
|
-
release = project.get_latest(pre_ok=pre_ok, major=major)
|
|
230
|
+
release = project.get_latest(pre_ok=pre_ok, major=repo_data.get("major", major))
|
|
234
231
|
|
|
235
232
|
# bail out, found nothing that looks like a release
|
|
236
233
|
if not release:
|
|
@@ -294,6 +291,11 @@ def latest(
|
|
|
294
291
|
)
|
|
295
292
|
if rpmspec_licence:
|
|
296
293
|
release["rpmspec_license"] = rpmspec_licence
|
|
294
|
+
|
|
295
|
+
release["source_url"] = project.release_download_url(
|
|
296
|
+
release, short_urls
|
|
297
|
+
)
|
|
298
|
+
|
|
297
299
|
return release
|
|
298
300
|
|
|
299
301
|
if output_format == "assets":
|
|
@@ -390,18 +392,24 @@ def update_spec(repo, res, sem="minor"):
|
|
|
390
392
|
else:
|
|
391
393
|
log.info("No newer version than already present in spec file")
|
|
392
394
|
sys.exit(2)
|
|
393
|
-
# update %lastversion_tag and %lastversion_dir, Version (?), Release
|
|
395
|
+
# update or add %lastversion_tag and %lastversion_dir, Version (?), Release
|
|
396
|
+
# Flag to track if '%global lastversion_tag' is present
|
|
397
|
+
lastversion_tag_present = False
|
|
398
|
+
# Flag to track if '%global lastversion_dir' is present
|
|
399
|
+
lastversion_dir_present = False
|
|
394
400
|
out = []
|
|
395
401
|
packager = get_rpm_packager()
|
|
396
402
|
with open(repo) as f:
|
|
397
403
|
for ln in f.readlines():
|
|
398
404
|
if ln.startswith("%global lastversion_tag "):
|
|
399
405
|
out.append(f'%global lastversion_tag {res["spec_tag"]}')
|
|
406
|
+
lastversion_tag_present = True
|
|
400
407
|
elif ln.startswith("%global lastversion_dir "):
|
|
401
408
|
out.append(
|
|
402
409
|
f"%global lastversion_dir "
|
|
403
410
|
f'{res["spec_name"]}-{res["spec_tag_no_prefix"]}'
|
|
404
411
|
)
|
|
412
|
+
lastversion_dir_present = True
|
|
405
413
|
elif ln.startswith("%global upstream_version "):
|
|
406
414
|
out.append(f'%global upstream_version {res["version"]}')
|
|
407
415
|
elif ln.startswith("Version:") and (
|
|
@@ -429,6 +437,19 @@ def update_spec(repo, res, sem="minor"):
|
|
|
429
437
|
out.append("Release:" + m.group(1) + "1" + release)
|
|
430
438
|
else:
|
|
431
439
|
out.append(ln.rstrip())
|
|
440
|
+
|
|
441
|
+
if not lastversion_tag_present:
|
|
442
|
+
# Insert %lastversion_tag at the top of the spec file
|
|
443
|
+
out.insert(0, f'%global lastversion_tag {res["spec_tag"]}')
|
|
444
|
+
|
|
445
|
+
if not lastversion_dir_present:
|
|
446
|
+
# Insert %lastversion_dir after %lastversion_tag
|
|
447
|
+
lastversion_tag_index = out.index(f'%global lastversion_tag {res["spec_tag"]}')
|
|
448
|
+
out.insert(
|
|
449
|
+
lastversion_tag_index + 1,
|
|
450
|
+
f"%global lastversion_dir {res['spec_name']}-{res['spec_tag_no_prefix']}",
|
|
451
|
+
)
|
|
452
|
+
|
|
432
453
|
with open(repo, "w") as f:
|
|
433
454
|
f.write("\n".join(out))
|
|
434
455
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: lastversion
|
|
3
|
-
Version: 3.4.
|
|
3
|
+
Version: 3.4.2
|
|
4
4
|
Summary: A CLI tool to find the latest stable version of an arbitrary project
|
|
5
5
|
Home-page: https://github.com/dvershinin/lastversion
|
|
6
6
|
Author: Danila Vershinin
|
|
@@ -76,6 +76,7 @@ Requires-Dist: markdown-include; extra == "build"
|
|
|
76
76
|
|
|
77
77
|
[](https://github.com/dvershinin/lastversion/actions/workflows/pythonpackage.yml)
|
|
78
78
|
[](https://badge.fury.io/py/lastversion)
|
|
79
|
+

|
|
79
80
|
[](https://lastversion.getpagespeed.com/en/latest/?badge=latest)
|
|
80
81
|
[](https://www.codacy.com/manual/GetPageSpeed/lastversion?utm_source=github.com&utm_medium=referral&utm_content=dvershinin/lastversion&utm_campaign=Badge_Grade)
|
|
81
82
|
[](https://www.codacy.com/gh/dvershinin/lastversion/dashboard?utm_source=github.com&utm_medium=referral&utm_content=dvershinin/lastversion&utm_campaign=Badge_Coverage)
|
|
@@ -17,6 +17,15 @@ def test_gitlab_1():
|
|
|
17
17
|
assert v >= version.parse("0.4.1")
|
|
18
18
|
|
|
19
19
|
|
|
20
|
+
def test_gitlab_format_json():
|
|
21
|
+
"""Test specifying a deep-level link at GitLab."""
|
|
22
|
+
repo = "https://gitlab.com/ddcci-driver-linux/ddcci-driver-linux/-/tree/master"
|
|
23
|
+
|
|
24
|
+
v = latest(repo, output_format="dict")
|
|
25
|
+
|
|
26
|
+
assert "tag_date" in v and v["tag_date"].day == 20
|
|
27
|
+
|
|
28
|
+
|
|
20
29
|
def test_gitlab_at():
|
|
21
30
|
"""Test specifying GitLab repo with an --at parameter."""
|
|
22
31
|
repo = "ddcci-driver-linux/ddcci-driver-linux"
|
|
@@ -15,3 +15,12 @@ def test_hg_nginx():
|
|
|
15
15
|
output = latest(repo, "version")
|
|
16
16
|
|
|
17
17
|
assert output >= version.parse("1.18.0")
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def test_hg_nginx_source_url():
|
|
21
|
+
"""Test NGINX."""
|
|
22
|
+
repo = "https://nginx.org/"
|
|
23
|
+
|
|
24
|
+
result = latest(repo, "source", major="1.18.0")
|
|
25
|
+
|
|
26
|
+
assert result == 'https://nginx.org/download/nginx-1.18.0.tar.gz'
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|