mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 16:23:01 +00:00
[WINESYNC] Explicitly use posix paths for git file manipulations.
Whenever using git, be it on Windows CMD, git-bash on Windows, or in *nix systems, git appears to always use posix-like paths internally. So, enforce them with posixpath when building/concatenating paths that are going to be passed to pygit2 functions. Otherwise, exceptions like the following one happens: ``` File "./winesync.py", line 296, in revert_staged_patchset self.reactos_index.remove(os.path.join(self.staged_patch_dir, patch_file_name)) [... skipped ...] OSError: index does not contain sdk\tools\winesync\setupapi_staging\0002-wine-staging-4.0-setupapi_winetest.patch at stage 0 ``` (The git index actually contains the specified path, but in "posix" form with slash-separators.) On *nix platforms, these changes should not matter.
This commit is contained in:
parent
e638ff59d1
commit
454901ab0b
1 changed files with 6 additions and 5 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
import posixpath
|
||||||
import string
|
import string
|
||||||
import argparse
|
import argparse
|
||||||
import subprocess
|
import subprocess
|
||||||
|
@ -54,7 +55,7 @@ class wine_sync:
|
||||||
with open(module + '.cfg', 'r') as file_input:
|
with open(module + '.cfg', 'r') as file_input:
|
||||||
self.module_cfg = yaml.safe_load(file_input)
|
self.module_cfg = yaml.safe_load(file_input)
|
||||||
|
|
||||||
self.staged_patch_dir = os.path.join('sdk', 'tools', 'winesync', self.module + '_staging')
|
self.staged_patch_dir = posixpath.join('sdk', 'tools', 'winesync', self.module + '_staging')
|
||||||
|
|
||||||
def create_or_checkout_wine_branch(self, wine_tag, wine_staging_tag):
|
def create_or_checkout_wine_branch(self, wine_tag, wine_staging_tag):
|
||||||
wine_branch_name = 'winesync-' + wine_tag + '-' + wine_staging_tag
|
wine_branch_name = 'winesync-' + wine_tag + '-' + wine_staging_tag
|
||||||
|
@ -110,7 +111,7 @@ class wine_sync:
|
||||||
wine_dir, wine_file = os.path.split(wine_path)
|
wine_dir, wine_file = os.path.split(wine_path)
|
||||||
if wine_dir in self.module_cfg['directories']:
|
if wine_dir in self.module_cfg['directories']:
|
||||||
# we have a mapping for the directory
|
# we have a mapping for the directory
|
||||||
return os.path.join(self.module_cfg['directories'][wine_dir], wine_file)
|
return posixpath.join(self.module_cfg['directories'][wine_dir], wine_file)
|
||||||
|
|
||||||
# no match
|
# no match
|
||||||
return None
|
return None
|
||||||
|
@ -228,7 +229,7 @@ class wine_sync:
|
||||||
os.mkdir(os.path.join(self.reactos_src, self.staged_patch_dir))
|
os.mkdir(os.path.join(self.reactos_src, self.staged_patch_dir))
|
||||||
with open(patch_path, 'w') as file_output:
|
with open(patch_path, 'w') as file_output:
|
||||||
file_output.write(complete_patch)
|
file_output.write(complete_patch)
|
||||||
self.reactos_index.add(os.path.join(self.staged_patch_dir, patch_file_name))
|
self.reactos_index.add(posixpath.join(self.staged_patch_dir, patch_file_name))
|
||||||
|
|
||||||
self.reactos_index.write()
|
self.reactos_index.write()
|
||||||
|
|
||||||
|
@ -264,7 +265,7 @@ class wine_sync:
|
||||||
|
|
||||||
def revert_staged_patchset(self):
|
def revert_staged_patchset(self):
|
||||||
# revert all of this in one commit
|
# revert all of this in one commit
|
||||||
staged_patch_dir_path = os.path.join(self.reactos_src, self.staged_patch_dir)
|
staged_patch_dir_path = posixpath.join(self.reactos_src, self.staged_patch_dir)
|
||||||
if not os.path.isdir(staged_patch_dir_path):
|
if not os.path.isdir(staged_patch_dir_path):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -285,7 +286,7 @@ class wine_sync:
|
||||||
print('Please check, remove the offending patch with git rm, and relaunch this script')
|
print('Please check, remove the offending patch with git rm, and relaunch this script')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
self.reactos_index.remove(os.path.join(self.staged_patch_dir, patch_file_name))
|
self.reactos_index.remove(posixpath.join(self.staged_patch_dir, patch_file_name))
|
||||||
self.reactos_index.write()
|
self.reactos_index.write()
|
||||||
os.remove(patch_path)
|
os.remove(patch_path)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue