Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use gi.require_version before import and make pygobject the last import #138

Merged
merged 3 commits into from
Sep 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
if: success()
if: success() && github.event_name != 'pull_request'
steps:
- uses: actions/checkout@v4

Expand Down
10 changes: 5 additions & 5 deletions flat-manager-client
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ import traceback
from argparse import ArgumentParser
from functools import reduce
from urllib.parse import urljoin, urlparse, urlunparse

import aiohttp
import aiohttp.client_exceptions
import gi
from gi.repository import Gio, GLib, OSTree
from tenacity import (
retry,
retry_if_exception_type,
stop_after_delay,
wait_random_exponential,
)

import aiohttp
import aiohttp.client_exceptions
import gi

gi.require_version("OSTree", "1.0")
from gi.repository import Gio, GLib, OSTree # noqa: E402

UPLOAD_CHUNK_LIMIT = 4 * 1024 * 1024
DEFAULT_LIMIT = 2**16
Expand Down
2 changes: 1 addition & 1 deletion src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fn load_gpg_key(
Some(gpg_key) => {
let mut cmd = Command::new("gpg2");
if let Some(gpg_homedir) = maybe_gpg_homedir {
cmd.arg(&format!("--homedir={gpg_homedir}"));
cmd.arg(format!("--homedir={gpg_homedir}"));
}
cmd.arg("--export").arg(gpg_key);

Expand Down
2 changes: 1 addition & 1 deletion src/jobs/commit_job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ impl CommitJobInstance {
for appstream_ref in appstream_refs {
let arch = appstream_ref.split('/').nth(1).unwrap();
let mut cmd = Command::new("ostree");
cmd.arg(&format!("--repo={}", &build_repo_path.to_str().unwrap()))
cmd.arg(format!("--repo={}", &build_repo_path.to_str().unwrap()))
.arg("checkout")
.arg("--user-mode")
.arg("--union")
Expand Down
2 changes: 1 addition & 1 deletion src/jobs/publish_job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ impl PublishJobInstance {
&format!("extracting {}", build_ref.ref_name),
);
let mut cmd = Command::new("ostree");
cmd.arg(&format!("--repo={}", &build_repo_path.to_str().unwrap()))
cmd.arg(format!("--repo={}", &build_repo_path.to_str().unwrap()))
.arg("checkout")
.arg("--user-mode")
.arg("--bareuseronly-dirs")
Expand Down
4 changes: 2 additions & 2 deletions src/jobs/republish_job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,14 @@ impl JobInstance for RepublishJobInstance {
.arg("--no-update-summary")
.arg("--disable-fsync"); // No need for fsync in intermediate steps

cmd.arg(&format!(
cmd.arg(format!(
"--src-repo={}",
repoconfig
.get_abs_repo_path()
.to_str()
.expect("repo paths should be valid unicode")
))
.arg(&format!("--src-ref={ref_name}"))
.arg(format!("--src-ref={ref_name}"))
.arg(tmp_repo_dir.path())
.arg(&ref_name);

Expand Down
2 changes: 1 addition & 1 deletion src/jobs/update_repo_job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ impl UpdateRepoJobInstance {
for appstream_ref in appstream_refs {
let arch = appstream_ref.split('/').nth(1).unwrap();
let mut cmd = Command::new("ostree");
cmd.arg(&format!("--repo={}", &repoconfig.path.to_str().unwrap()))
cmd.arg(format!("--repo={}", &repoconfig.path.to_str().unwrap()))
.arg("checkout")
.arg("--user-mode")
.arg("--union")
Expand Down
6 changes: 1 addition & 5 deletions src/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,7 @@ where
};

let user_agent = if let Some(val) = req.headers().get("User-Agent") {
if let Ok(s) = val.to_str() {
s
} else {
"-"
}
val.to_str().unwrap_or("-")
} else {
"-"
}
Expand Down
6 changes: 3 additions & 3 deletions src/ostree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -956,9 +956,9 @@ pub fn pull_commit_async(
});
}

cmd.arg(&format!("--repo={}", &repo_path.to_str().unwrap()))
cmd.arg(format!("--repo={}", &repo_path.to_str().unwrap()))
.arg("pull")
.arg(&format!("--url={url}"))
.arg(format!("--url={url}"))
.arg("upstream")
.arg(&commit);

Expand Down Expand Up @@ -1060,7 +1060,7 @@ pub fn prune_async(repo_path: &Path) -> Box<dyn Future<Item = (), Error = Ostree
}

cmd.arg("prune")
.arg(&format!("--repo={}", repo_path.to_string_lossy()))
.arg(format!("--repo={}", repo_path.to_string_lossy()))
.arg("--keep-younger-than=3 days ago");

Box::new(
Expand Down