Skip to content

Commit

Permalink
dbt deps prerelease install bugs + add install-prerelease parameter t…
Browse files Browse the repository at this point in the history
…o packages.yml (#3624)

* Fix dbt deps prerelease install bugs

* Add install-prerelease parameter to hub packages in packages.yml

automatic commit by git-black, original commits:
  52ec790
  • Loading branch information
NiallRees authored and iknox-fa committed Feb 8, 2022
1 parent 09cbfd2 commit da23909
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
7 changes: 2 additions & 5 deletions core/dbt/deps/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,7 @@ def download_and_untar(self, download_url, tar_path, deps_path, package_name):

class RegistryUnpinnedPackage(RegistryPackageMixin, UnpinnedPackage[RegistryPinnedPackage]):
def __init__(
self,
package: str,
versions: List[semver.VersionSpecifier],
install_prerelease: bool
self, package: str, versions: List[semver.VersionSpecifier], install_prerelease: bool
) -> None:
super().__init__(package)
self.versions = versions
Expand All @@ -110,7 +107,7 @@ def from_contract(cls, contract: RegistryPackage) -> "RegistryUnpinnedPackage":
return cls(
package=contract.package,
versions=versions,
install_prerelease=contract.install_prerelease
install_prerelease=contract.install_prerelease,
)

def incorporate(self, other: "RegistryUnpinnedPackage") -> "RegistryUnpinnedPackage":
Expand Down
11 changes: 4 additions & 7 deletions core/dbt/semver.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ def compare(self, other):
if self.is_unbounded or other.is_unbounded:
return 0

for key in ['major', 'minor', 'patch', 'prerelease']:
for key in ["major", "minor", "patch", "prerelease"]:
(a, b) = (getattr(self, key), getattr(other, key))
if key == 'prerelease':
if key == "prerelease":
if a is None and b is None:
continue
if a is None:
Expand Down Expand Up @@ -424,18 +424,15 @@ def resolve_to_specific_version(requested_range, available_versions):
version = VersionSpecifier.from_version_string(version_string)

if versions_compatible(version, requested_range.start, requested_range.end) and (
requested_range.start, requested_range.end) and
max_version is None or max_version.compare(version) < 0
):
max_version = version
max_version_string = version_string

return max_version_string


def filter_installable(
versions: List[str],
install_prerelease: bool
) -> List[str]:
def filter_installable(versions: List[str], install_prerelease: bool) -> List[str]:
installable = []
installable_dict = {}
for version_string in versions:
Expand Down

0 comments on commit da23909

Please sign in to comment.