Unify packse find links urls (#2969)

The sync scenarios script is broken, so i did the updates manually

```
$ ./scripts/sync_scenarios.sh
Setting up a temporary environment...
Using Python 3.12.1 interpreter at: /home/konsti/projects/uv/.venv/bin/python3
Creating virtualenv at: .venv
Activate with: source .venv/bin/activate
  × No solution found when resolving dependencies:
  ╰─▶ Because docutils==0.21.post1 is unusable because the package metadata was inconsistent and you require docutils==0.21.post1, we can conclude that the requirements are unsatisfiable.

      hint: Metadata for docutils==0.21.post1 was inconsistent:
        Package metadata version `0.21` does not match given version `0.21.post1`
```

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
This commit is contained in:
konsti 2024-04-11 10:35:22 +02:00 committed by GitHub
parent 5f59e30106
commit c85c52d4ce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 24 additions and 20 deletions

View file

@ -49,7 +49,7 @@ impl GitSource {
} }
/// Fetch the underlying Git repository at the given revision. /// Fetch the underlying Git repository at the given revision.
#[instrument(skip(self))] #[instrument(skip(self), fields(repository = %self.git.repository, rev = ?self.git.precise))]
pub fn fetch(self) -> Result<Fetch> { pub fn fetch(self) -> Result<Fetch> {
// The path to the repo, within the Git database. // The path to the repo, within the Git database.
let ident = digest(&RepositoryUrl::new(&self.git.repository)); let ident = digest(&RepositoryUrl::new(&self.git.repository));

View file

@ -22,6 +22,11 @@ use uv_toolchain::{toolchains_for_version, PythonVersion};
// Exclude any packages uploaded after this date. // Exclude any packages uploaded after this date.
pub static EXCLUDE_NEWER: &str = "2024-03-25T00:00:00Z"; pub static EXCLUDE_NEWER: &str = "2024-03-25T00:00:00Z";
/// Using a find links url allows using `--index-url` instead of `--extra-index-url` in tests
/// to prevent dependency confusion attacks against our test suite.
pub const BUILD_VENDOR_LINKS_URL: &str =
"https://raw.githubusercontent.com/astral-sh/packse/0.3.14/vendor/links.html";
#[doc(hidden)] // Macro and test context only, don't use directly. #[doc(hidden)] // Macro and test context only, don't use directly.
pub const INSTA_FILTERS: &[(&str, &str)] = &[ pub const INSTA_FILTERS: &[(&str, &str)] = &[
(r"--cache-dir [^\s]+", "--cache-dir [CACHE_DIR]"), (r"--cache-dir [^\s]+", "--cache-dir [CACHE_DIR]"),

View file

@ -1,7 +1,7 @@
//! DO NOT EDIT //! DO NOT EDIT
//! //!
//! Generated with `./scripts/sync_scenarios.sh` //! Generated with `./scripts/sync_scenarios.sh`
//! Scenarios from <https://github.com/zanieb/packse/tree/0.3.13/scenarios> //! Scenarios from <https://github.com/astral-sh/packse/tree/0.3.14/scenarios>
//! //!
#![cfg(all(feature = "python", feature = "pypi", unix))] #![cfg(all(feature = "python", feature = "pypi", unix))]
@ -27,9 +27,9 @@ fn command(context: &TestContext, python_versions: &[&str]) -> Command {
.arg("compile") .arg("compile")
.arg("requirements.in") .arg("requirements.in")
.arg("--index-url") .arg("--index-url")
.arg("https://astral-sh.github.io/packse/0.3.13/simple-html/") .arg("https://astral-sh.github.io/packse/0.3.14/simple-html/")
.arg("--find-links") .arg("--find-links")
.arg("https://raw.githubusercontent.com/zanieb/packse/0.3.13/vendor/links.html") .arg("https://raw.githubusercontent.com/astral-sh/packse/0.3.14/vendor/links.html")
.arg("--cache-dir") .arg("--cache-dir")
.arg(context.cache_dir.path()) .arg(context.cache_dir.path())
.env("VIRTUAL_ENV", context.venv.as_os_str()) .env("VIRTUAL_ENV", context.venv.as_os_str())

View file

@ -1,5 +1,7 @@
#![cfg(all(feature = "python", feature = "pypi"))] #![cfg(all(feature = "python", feature = "pypi"))]
use std::process::Command;
use anyhow::Result; use anyhow::Result;
use assert_cmd::prelude::*; use assert_cmd::prelude::*;
use assert_fs::prelude::*; use assert_fs::prelude::*;
@ -7,12 +9,10 @@ use base64::{prelude::BASE64_STANDARD as base64, Engine};
use indoc::indoc; use indoc::indoc;
use itertools::Itertools; use itertools::Itertools;
use std::process::Command;
use common::{uv_snapshot, TestContext}; use common::{uv_snapshot, TestContext};
use uv_fs::Simplified; use uv_fs::Simplified;
use crate::common::get_bin; use crate::common::{get_bin, BUILD_VENDOR_LINKS_URL};
mod common; mod common;
@ -3150,7 +3150,7 @@ fn already_installed_dependent_editable() {
// Disable the index to guard this test against dependency confusion attacks // Disable the index to guard this test against dependency confusion attacks
.arg("--no-index") .arg("--no-index")
.arg("--find-links") .arg("--find-links")
.arg("https://raw.githubusercontent.com/astral-sh/packse/0.3.12/vendor/links.html"), @r###" .arg(BUILD_VENDOR_LINKS_URL), @r###"
success: true success: true
exit_code: 0 exit_code: 0
----- stdout ----- ----- stdout -----
@ -3185,7 +3185,7 @@ fn already_installed_dependent_editable() {
// Disable the index to guard this test against dependency confusion attacks // Disable the index to guard this test against dependency confusion attacks
.arg("--no-index") .arg("--no-index")
.arg("--find-links") .arg("--find-links")
.arg("https://raw.githubusercontent.com/astral-sh/packse/0.3.12/vendor/links.html"), @r###" .arg(BUILD_VENDOR_LINKS_URL), @r###"
success: false success: false
exit_code: 1 exit_code: 1
----- stdout ----- ----- stdout -----
@ -3246,7 +3246,7 @@ fn already_installed_local_path_dependent() {
// Disable the index to guard this test against dependency confusion attacks // Disable the index to guard this test against dependency confusion attacks
.arg("--no-index") .arg("--no-index")
.arg("--find-links") .arg("--find-links")
.arg("https://raw.githubusercontent.com/astral-sh/packse/0.3.12/vendor/links.html"), @r###" .arg(BUILD_VENDOR_LINKS_URL), @r###"
success: true success: true
exit_code: 0 exit_code: 0
----- stdout ----- ----- stdout -----
@ -3281,7 +3281,7 @@ fn already_installed_local_path_dependent() {
// Disable the index to guard this test against dependency confusion attacks // Disable the index to guard this test against dependency confusion attacks
.arg("--no-index") .arg("--no-index")
.arg("--find-links") .arg("--find-links")
.arg("https://raw.githubusercontent.com/astral-sh/packse/0.3.12/vendor/links.html"), @r###" .arg(BUILD_VENDOR_LINKS_URL), @r###"
success: false success: false
exit_code: 1 exit_code: 1
----- stdout ----- ----- stdout -----
@ -3321,7 +3321,7 @@ fn already_installed_local_path_dependent() {
// Disable the index to guard this test against dependency confusion attacks // Disable the index to guard this test against dependency confusion attacks
.arg("--no-index") .arg("--no-index")
.arg("--find-links") .arg("--find-links")
.arg("https://raw.githubusercontent.com/astral-sh/packse/0.3.12/vendor/links.html"), @r###" .arg(BUILD_VENDOR_LINKS_URL), @r###"
success: false success: false
exit_code: 1 exit_code: 1
----- stdout ----- ----- stdout -----
@ -3343,7 +3343,7 @@ fn already_installed_local_path_dependent() {
// Disable the index to guard this test against dependency confusion attacks // Disable the index to guard this test against dependency confusion attacks
.arg("--no-index") .arg("--no-index")
.arg("--find-links") .arg("--find-links")
.arg("https://raw.githubusercontent.com/astral-sh/packse/0.3.12/vendor/links.html"), @r###" .arg(BUILD_VENDOR_LINKS_URL), @r###"
success: true success: true
exit_code: 0 exit_code: 0
----- stdout ----- ----- stdout -----

View file

@ -1,7 +1,7 @@
//! DO NOT EDIT //! DO NOT EDIT
//! //!
//! Generated with `./scripts/sync_scenarios.sh` //! Generated with `./scripts/sync_scenarios.sh`
//! Scenarios from <https://github.com/zanieb/packse/tree/0.3.13/scenarios> //! Scenarios from <https://github.com/astral-sh/packse/tree/0.3.14/scenarios>
//! //!
#![cfg(all(feature = "python", feature = "pypi", unix))] #![cfg(all(feature = "python", feature = "pypi", unix))]
@ -46,9 +46,9 @@ fn command(context: &TestContext) -> Command {
.arg("pip") .arg("pip")
.arg("install") .arg("install")
.arg("--index-url") .arg("--index-url")
.arg("https://astral-sh.github.io/packse/0.3.13/simple-html/") .arg("https://astral-sh.github.io/packse/0.3.14/simple-html/")
.arg("--find-links") .arg("--find-links")
.arg("https://raw.githubusercontent.com/zanieb/packse/0.3.13/vendor/links.html") .arg("https://raw.githubusercontent.com/astral-sh/packse/0.3.14/vendor/links.html")
.arg("--cache-dir") .arg("--cache-dir")
.arg(context.cache_dir.path()) .arg(context.cache_dir.path())
.env("VIRTUAL_ENV", context.venv.as_os_str()) .env("VIRTUAL_ENV", context.venv.as_os_str())

View file

@ -65,7 +65,6 @@ except ImportError:
) )
exit(1) exit(1)
try: try:
import chevron_blue import chevron_blue
except ImportError: except ImportError:
@ -175,11 +174,11 @@ def main(scenarios: list[Path], snapshot_update: bool = True):
# Add generated metadata # Add generated metadata
data["generated_from"] = ( data["generated_from"] = (
f"https://github.com/zanieb/packse/tree/{ref}/scenarios" f"https://github.com/astral-sh/packse/tree/{ref}/scenarios"
) )
data["generated_with"] = "./scripts/sync_scenarios.sh" data["generated_with"] = "./scripts/sync_scenarios.sh"
data["vendor_links"] = ( data["vendor_links"] = (
f"https://raw.githubusercontent.com/zanieb/packse/{ref}/vendor/links.html" f"https://raw.githubusercontent.com/astral-sh/packse/{ref}/vendor/links.html"
) )
data["index_url"] = f"https://astral-sh.github.io/packse/{ref}/simple-html/" data["index_url"] = f"https://astral-sh.github.io/packse/{ref}/simple-html/"

View file

@ -36,7 +36,7 @@ nh3==0.2.17
# via readme-renderer # via readme-renderer
packaging==24.0 packaging==24.0
# via hatchling # via hatchling
packse==0.3.13 packse==0.3.14
pathspec==0.12.1 pathspec==0.12.1
# via hatchling # via hatchling
pkginfo==1.10.0 pkginfo==1.10.0