mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-25 19:14:03 +03:00
Ignore pre-releases of Django
This commit is contained in:
parent
710998eb60
commit
007fd0206e
|
@ -65,30 +65,27 @@ def get_all_latest_django_versions() -> tuple[str, list[str]]:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# Begin parsing and verification
|
# Begin parsing and verification
|
||||||
base_django_version = get_name_and_version(line)[1].split(".")
|
_, current_version_str = get_name_and_version(line)
|
||||||
django_versions = get_package_versions(get_package_info("django"), include_pre=True)
|
# Get a tuple of (major, minor) - ignoring patch version
|
||||||
_needed_django_versions: set[tuple] = set()
|
current_minor_version = tuple(current_version_str.split(".")[:2])
|
||||||
actual_needed_django_versions: list[str] = []
|
all_django_versions = get_package_versions(get_package_info("django"))
|
||||||
for x in django_versions:
|
newer_versions: set[tuple] = set()
|
||||||
_version = x.split(".")
|
for version_str in all_django_versions:
|
||||||
# Compare if major is higher or if minor is higher iff major is the same
|
released_minor_version = tuple(version_str.split(".")[:2])
|
||||||
if (_version[0] > base_django_version[0]) or (
|
if released_minor_version > current_minor_version:
|
||||||
_version[0] == base_django_version[0]
|
newer_versions.add(released_minor_version)
|
||||||
and _version[1] > base_django_version[1]
|
|
||||||
):
|
|
||||||
will_add = (_version[0], _version[1])
|
|
||||||
if will_add not in _needed_django_versions:
|
|
||||||
_needed_django_versions.add(will_add)
|
|
||||||
actual_needed_django_versions.append(x)
|
|
||||||
|
|
||||||
return line, actual_needed_django_versions
|
needed_versions_str = ['.'.join(v) for v in sorted(newer_versions)]
|
||||||
|
return line, needed_versions_str
|
||||||
|
|
||||||
|
|
||||||
def get_first_digit(tokens) -> str:
|
def get_first_digit(tokens) -> str:
|
||||||
return next(item for item in tokens if item.isdigit())
|
return next(item for item in tokens if item.isdigit())
|
||||||
|
|
||||||
|
|
||||||
_TABLE_HEADER = """{file}.txt
|
_TABLE_HEADER = """
|
||||||
|
|
||||||
|
## {file}.txt
|
||||||
|
|
||||||
| Name | Version in Master | {dj_version} Compatible Version | OK |
|
| Name | Version in Master | {dj_version} Compatible Version | OK |
|
||||||
| ---- | :---------------: | :-----------------------------: | :-: |
|
| ---- | :---------------: | :-----------------------------: | :-: |
|
||||||
|
|
Loading…
Reference in New Issue
Block a user