Skip to content

Commit

Permalink
Fix failed to rename archive file
Browse files Browse the repository at this point in the history
  • Loading branch information
danyeaw committed Oct 20, 2024
1 parent 7bb293f commit 04257a0
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
46 changes: 46 additions & 0 deletions gvsbuild/patches/librsvg/001-fix-failed-to-rename-query-rust.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
diff --git a/meson/query-rustc.py b/meson/query-rustc.py
index 2b169b1fc5ad7dff2dfec1d62214ee4cb1fce0de..f97cb692d1a080a730be8953c60e52ffc9a71b91 100755
--- a/meson/query-rustc.py
+++ b/meson/query-rustc.py
@@ -64,7 +64,6 @@ def retrive_version_info(output, query):

if __name__ == "__main__":
args = parser.parse_args()
- dummy_out = tempfile.NamedTemporaryFile()
query = args.query
query_arg = None
rustc_cmd = [Path(args.RUSTC).as_posix()]
@@ -85,17 +84,23 @@ if __name__ == "__main__":
if args.target:
rustc_cmd.extend(['--target', args.target])

- # We need these for '--print=native-static-libs' on Windows
- if query == 'native-static-libs':
- rustc_cmd.extend(['--crate-type', 'staticlib'])
- rustc_cmd.append(os.devnull)
- rustc_cmd.extend(['-o', dummy_out.name])
+ fd, dummy_out = tempfile.mkstemp()
+ os.close(fd)
+ try:
+ # We need these for '--print=native-static-libs' on Windows
+ if query == 'native-static-libs':
+ rustc_cmd.extend(['--crate-type', 'staticlib'])
+ rustc_cmd.append(os.devnull)
+ rustc_cmd.extend(['-o', dummy_out])
+
+ query_results = subprocess.run(
+ rustc_cmd,
+ capture_output=True,
+ text=True,
+ )
+ finally:
+ os.unlink(dummy_out)

- query_results = subprocess.run(
- rustc_cmd,
- capture_output=True,
- text=True,
- )
if query == 'native-static-libs':
retrieve_native_static_libs_from_output(query_results.stderr)
elif query == 'default-host-toolchain' or query == 'stable-actual-version':
5 changes: 4 additions & 1 deletion gvsbuild/projects/librsvg.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ def __init__(self):
"libxml2",
"freetype",
],
patches=[],
patches=[
# https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/1040
"001-fix-failed-to-rename-query-rust.patch",
],
)

if self.opts.enable_gi:
Expand Down

0 comments on commit 04257a0

Please sign in to comment.