Skip to content

Commit

Permalink
create file if not exists
Browse files Browse the repository at this point in the history
  • Loading branch information
bjia56 committed Mar 21, 2024
1 parent 1aed23a commit 69270a6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions patches/3.10/portable/03-sysconfig-pkgconfig.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py
index ebe3711827..dc4cf39911 100644
index ebe3711827..d2a1716a1c 100644
--- a/Lib/sysconfig.py
+++ b/Lib/sysconfig.py
@@ -847,5 +847,54 @@ def _main():
Expand Down Expand Up @@ -38,7 +38,7 @@ index ebe3711827..dc4cf39911 100644
+ data = data.replace(line, f'prefix={prefix}')
+ break
+ if not os.path.exists(os.path.join(portable_python_pkgconfig, file)):
+ with open(os.path.join(portable_python_pkgconfig, file), 'w', encoding='utf8') as f:
+ with open(os.path.join(portable_python_pkgconfig, file), 'w+', encoding='utf8') as f:
+ f.write(data)
+ else:
+ with open(os.path.join(portable_python_pkgconfig, file), 'r', encoding='utf8') as f:
Expand Down
4 changes: 2 additions & 2 deletions patches/3.11/portable/03-sysconfig-pkgconfig.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py
index ebe3711827..dc4cf39911 100644
index ebe3711827..d2a1716a1c 100644
--- a/Lib/sysconfig.py
+++ b/Lib/sysconfig.py
@@ -847,5 +847,54 @@ def _main():
Expand Down Expand Up @@ -38,7 +38,7 @@ index ebe3711827..dc4cf39911 100644
+ data = data.replace(line, f'prefix={prefix}')
+ break
+ if not os.path.exists(os.path.join(portable_python_pkgconfig, file)):
+ with open(os.path.join(portable_python_pkgconfig, file), 'w', encoding='utf8') as f:
+ with open(os.path.join(portable_python_pkgconfig, file), 'w+', encoding='utf8') as f:
+ f.write(data)
+ else:
+ with open(os.path.join(portable_python_pkgconfig, file), 'r', encoding='utf8') as f:
Expand Down
4 changes: 2 additions & 2 deletions patches/3.12/portable/03-sysconfig-pkgconfig.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py
index ebe3711827..dc4cf39911 100644
index ebe3711827..d2a1716a1c 100644
--- a/Lib/sysconfig.py
+++ b/Lib/sysconfig.py
@@ -847,5 +847,54 @@ def _main():
Expand Down Expand Up @@ -38,7 +38,7 @@ index ebe3711827..dc4cf39911 100644
+ data = data.replace(line, f'prefix={prefix}')
+ break
+ if not os.path.exists(os.path.join(portable_python_pkgconfig, file)):
+ with open(os.path.join(portable_python_pkgconfig, file), 'w', encoding='utf8') as f:
+ with open(os.path.join(portable_python_pkgconfig, file), 'w+', encoding='utf8') as f:
+ f.write(data)
+ else:
+ with open(os.path.join(portable_python_pkgconfig, file), 'r', encoding='utf8') as f:
Expand Down
4 changes: 2 additions & 2 deletions patches/3.9/portable/03-sysconfig-pkgconfig.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py
index ebe3711827..dc4cf39911 100644
index ebe3711827..d2a1716a1c 100644
--- a/Lib/sysconfig.py
+++ b/Lib/sysconfig.py
@@ -847,5 +847,54 @@ def _main():
Expand Down Expand Up @@ -38,7 +38,7 @@ index ebe3711827..dc4cf39911 100644
+ data = data.replace(line, f'prefix={prefix}')
+ break
+ if not os.path.exists(os.path.join(portable_python_pkgconfig, file)):
+ with open(os.path.join(portable_python_pkgconfig, file), 'w', encoding='utf8') as f:
+ with open(os.path.join(portable_python_pkgconfig, file), 'w+', encoding='utf8') as f:
+ f.write(data)
+ else:
+ with open(os.path.join(portable_python_pkgconfig, file), 'r', encoding='utf8') as f:
Expand Down

0 comments on commit 69270a6

Please sign in to comment.