Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
G
git-repo
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux-tools
git-repo
Commits
db2da597
Commit
db2da597
authored
Sep 15, 2015
by
Matthias Putz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Portable: fixing diverse file handling issues
parent
357d4603
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
2 deletions
+24
-2
portable.py
portable.py
+20
-0
project.py
project.py
+4
-2
No files found.
portable.py
View file @
db2da597
...
...
@@ -3,7 +3,9 @@ import os
import
pager
import
platform
import
re
import
shutil
import
socket
import
stat
import
sys
import
subprocess
import
threading
...
...
@@ -18,6 +20,24 @@ if isUnix():
def
to_windows_path
(
path
):
return
path
.
replace
(
'/'
,
'
\\
'
)
def
rmtree
(
path
):
shutil
.
rmtree
(
path
,
onerror
=
onerror
)
def
rename
(
src
,
dst
):
if
isUnix
():
os
.
rename
(
src
,
dst
)
else
:
if
os
.
path
.
exists
(
dst
):
os
.
remove
(
dst
)
os
.
rename
(
src
,
dst
)
def
onerror
(
function
,
path
,
excinfo
):
if
not
os
.
access
(
path
,
os
.
W_OK
):
os
.
chmod
(
path
,
stat
.
S_IWUSR
)
function
(
path
)
else
:
raise
def
input_reader
(
src
,
dest
,
std_name
):
if
isUnix
():
...
...
project.py
View file @
db2da597
...
...
@@ -55,7 +55,8 @@ def _lwrite(path, content):
fd
.
close
()
try
:
os
.
rename
(
lock
,
path
)
# os.rename(lock, path)
portable
.
rename
(
lock
,
path
)
except
OSError
:
os
.
remove
(
lock
)
raise
...
...
@@ -2401,7 +2402,8 @@ class Project(object):
self
.
_CopyAndLinkFiles
()
except
Exception
:
if
init_dotgit
:
shutil
.
rmtree
(
dotgit
)
# shutil.rmtree(dotgit)
portable
.
rmtree
(
dotgit
)
raise
def
_gitdir_path
(
self
,
path
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment