Skip to content

Commit

Permalink
fix: py-rattler
Browse files Browse the repository at this point in the history
  • Loading branch information
baszalmstra committed Sep 12, 2024
1 parent 6e596e2 commit 0f2eedc
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 14 deletions.
2 changes: 1 addition & 1 deletion crates/rattler/src/install/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ mod test {
};

test_install_python(
packages.filter_map(|p| Some(p.as_conda()?.location().as_url()?)),
packages.filter_map(|p| p.as_conda()?.location().as_url().cloned()),
"conda-lock",
current_platform,
)
Expand Down
20 changes: 20 additions & 0 deletions py-rattler/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions py-rattler/rattler/lock/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def is_conda(self) -> bool:
>>> lock_file = LockFile.from_path("../test-data/test.lock")
>>> env = lock_file.default_environment()
>>> lock_packages = env.packages(Platform("osx-arm64"))
>>> conda_pkgs = [pkg for pkg in lock_packages if pkg.url_or_path.startswith("https://conda.anaconda.org/")]
>>> conda_pkgs = [pkg for pkg in lock_packages if pkg.location.startswith("https://conda.anaconda.org/")]
>>> conda_pkgs[0].is_conda
True
>>>
Expand All @@ -88,7 +88,7 @@ def is_pypi(self) -> bool:
>>> lock_file = LockFile.from_path("../test-data/test.lock")
>>> env = lock_file.default_environment()
>>> lock_packages = env.packages(Platform("osx-arm64"))
>>> pypi_pkgs = [pkg for pkg in lock_packages if pkg.url_or_path.startswith("https://files.pythonhosted.org/")]
>>> pypi_pkgs = [pkg for pkg in lock_packages if pkg.location.startswith("https://files.pythonhosted.org/")]
>>> pypi_pkgs[0].is_pypi
True
>>>
Expand Down Expand Up @@ -116,7 +116,7 @@ def name(self) -> str:
return self._package.name

@property
def url_or_path(self) -> str:
def location(self) -> str:
"""
Returns the URL of the package
Expand All @@ -127,12 +127,12 @@ def url_or_path(self) -> str:
>>> lock_file = LockFile.from_path("../test-data/test.lock")
>>> env = lock_file.default_environment()
>>> lock_package = env.packages(Platform("osx-arm64"))[0]
>>> lock_package.url_or_path
>>> lock_package.location
'https://conda.anaconda.org/...'
>>>
```
"""
return self._package.url_or_path
return self._package.location

@property
def version(self) -> str:
Expand Down
6 changes: 3 additions & 3 deletions py-rattler/rattler/lock/pypi.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def version(self) -> str:
return self._data.version

@property
def url_or_path(self) -> str:
def location(self) -> str:
"""
The URL that points to where the artifact can be downloaded from.
Expand All @@ -84,12 +84,12 @@ def url_or_path(self) -> str:
>>> env = lock_file.default_environment()
>>> pypi_packages = env.pypi_packages()
>>> data = pypi_packages[Platform("osx-arm64")][0][0]
>>> data.url_or_path
>>> data.location
'https://files.pythonhosted.org/...'
>>>
```
"""
return self._data.url_or_path
return self._data.location

@property
def hash(self) -> Optional[PackageHashes]:
Expand Down
10 changes: 5 additions & 5 deletions py-rattler/src/lock/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,8 @@ impl PyLockedPackage {
}

#[getter]
pub fn url_or_path(&self) -> String {
self.inner.url_or_path().to_string()
pub fn location(&self) -> String {
self.inner.location().to_string()
}

pub fn as_conda(&self) -> Option<PyRecord> {
Expand All @@ -347,7 +347,7 @@ impl PyLockedPackage {
package_record: pkg.package_record().clone(),
file_name: pkg.file_name().unwrap_or("").into(),
channel: pkg.channel().map_or("".to_string(), |c| c.to_string()),
url: pkg.url().clone(),
url: pkg.location().as_url()?.clone(),
}));
}
None
Expand Down Expand Up @@ -418,8 +418,8 @@ impl PyPypiPackageData {

/// The URL that points to where the artifact can be downloaded from.
#[getter]
pub fn url_or_path(&self) -> String {
self.inner.url_or_path.to_string()
pub fn location(&self) -> String {
self.inner.location.to_string()
}

/// Whether the package is installed in editable mode or not.
Expand Down

0 comments on commit 0f2eedc

Please sign in to comment.