Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Autopsy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IRT
Autopsy
Commits
2aab2701
Commit
2aab2701
authored
12 years ago
by
Devin148
Browse files
Options
Downloads
Patches
Plain Diff
Delete cloned Autopsy when run from CMD
parent
07cea192
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
update_versions.py
+21
-3
21 additions, 3 deletions
update_versions.py
with
21 additions
and
3 deletions
update_versions.py
+
21
−
3
View file @
2aab2701
...
...
@@ -24,10 +24,13 @@
# update the version numbers and dependencies.
# ------------------------------------------------------------
import
errno
import
os
import
shutil
import
stat
import
subprocess
import
sys
import
traceback
from
os
import
remove
,
close
from
shutil
import
move
from
tempfile
import
mkstemp
...
...
@@ -685,7 +688,7 @@ def make_dir(dir):
def
del_dir
(
dir
):
try
:
if
os
.
path
.
isdir
(
dir
):
shutil
.
rmtree
(
dir
)
shutil
.
rmtree
(
dir
,
ignore_errors
=
False
,
onerror
=
handleRemoveReadonly
)
if
os
.
path
.
isdir
(
dir
):
return
False
else
:
...
...
@@ -693,8 +696,18 @@ def del_dir(dir):
return
True
except
:
print
(
"
Exception thrown when deleting directory
"
)
traceback
.
print_exc
()
return
False
# Handle any permisson errors thrown by shutil.rmtree
def
handleRemoveReadonly
(
func
,
path
,
exc
):
excvalue
=
exc
[
1
]
if
func
in
(
os
.
rmdir
,
os
.
remove
)
and
excvalue
.
errno
==
errno
.
EACCES
:
os
.
chmod
(
path
,
stat
.
S_IRWXU
|
stat
.
S_IRWXG
|
stat
.
S_IRWXO
)
# 0777
func
(
path
)
else
:
raise
# Run git clone and git checkout for the tag
def
do_git
(
tag
,
tag_dir
):
try
:
...
...
@@ -801,8 +814,13 @@ def main():
# 2) Get the modules in the clone and the source
# 3) Generate the xml comparison
# -----------------------------------------------
del_dir
(
"
./build/autopsy-update_versions
"
)
tag_dir
=
os
.
path
.
abspath
(
"
./build/autopsy-update_versions
"
)
if
not
del_dir
(
"
./build/
"
+
tag
):
print
(
"
\n\n
=========================================
"
)
print
(
"
Failed to delete previous Autopsy clone.
"
)
print
(
"
Unable to continue...
"
)
print
(
"
=========================================
"
)
return
1
tag_dir
=
os
.
path
.
abspath
(
"
./build/
"
+
tag
)
if
not
do_git
(
tag
,
tag_dir
):
return
1
sys
.
stdout
.
flush
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment