Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
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
edx
edx-platform
Commits
9251a6dc
Commit
9251a6dc
authored
Mar 09, 2016
by
Jesse Zoldak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Always uninstall python packages on the uninstall list before installing the python requirements
parent
2c3b728c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
8 deletions
+13
-8
pavelib/prereqs.py
+13
-8
No files found.
pavelib/prereqs.py
View file @
9251a6dc
...
@@ -55,6 +55,15 @@ def no_prereq_install():
...
@@ -55,6 +55,15 @@ def no_prereq_install():
return
False
return
False
def
create_prereqs_cache_dir
():
"""Create the directory for storing the hashes, if it doesn't exist already."""
try
:
os
.
makedirs
(
PREREQS_STATE_DIR
)
except
OSError
:
if
not
os
.
path
.
isdir
(
PREREQS_STATE_DIR
):
raise
def
compute_fingerprint
(
path_list
):
def
compute_fingerprint
(
path_list
):
"""
"""
Hash the contents of all the files and directories in `path_list`.
Hash the contents of all the files and directories in `path_list`.
...
@@ -107,12 +116,7 @@ def prereq_cache(cache_name, paths, install_func):
...
@@ -107,12 +116,7 @@ def prereq_cache(cache_name, paths, install_func):
# Update the cache with the new hash
# Update the cache with the new hash
# If the code executed within the context fails (throws an exception),
# If the code executed within the context fails (throws an exception),
# then this step won't get executed.
# then this step won't get executed.
try
:
create_prereqs_cache_dir
()
os
.
makedirs
(
PREREQS_STATE_DIR
)
except
OSError
:
if
not
os
.
path
.
isdir
(
PREREQS_STATE_DIR
):
raise
with
open
(
cache_file_path
,
"w"
)
as
cache_file
:
with
open
(
cache_file_path
,
"w"
)
as
cache_file
:
# Since the pip requirement files are modified during the install
# Since the pip requirement files are modified during the install
# process, we need to store the hash generated AFTER the installation
# process, we need to store the hash generated AFTER the installation
...
@@ -162,7 +166,6 @@ PACKAGES_TO_UNINSTALL = [
...
@@ -162,7 +166,6 @@ PACKAGES_TO_UNINSTALL = [
]
]
@task
def
uninstall_python_packages
():
def
uninstall_python_packages
():
"""
"""
Uninstall Python packages that need explicit uninstallation.
Uninstall Python packages that need explicit uninstallation.
...
@@ -179,6 +182,7 @@ def uninstall_python_packages():
...
@@ -179,6 +182,7 @@ def uninstall_python_packages():
hasher
.
update
(
repr
(
PACKAGES_TO_UNINSTALL
))
hasher
.
update
(
repr
(
PACKAGES_TO_UNINSTALL
))
expected_version
=
hasher
.
hexdigest
()
expected_version
=
hasher
.
hexdigest
()
state_file_path
=
os
.
path
.
join
(
PREREQS_STATE_DIR
,
"Python_uninstall.sha1"
)
state_file_path
=
os
.
path
.
join
(
PREREQS_STATE_DIR
,
"Python_uninstall.sha1"
)
create_prereqs_cache_dir
()
if
os
.
path
.
isfile
(
state_file_path
):
if
os
.
path
.
isfile
(
state_file_path
):
with
open
(
state_file_path
)
as
state_file
:
with
open
(
state_file_path
)
as
state_file
:
...
@@ -238,6 +242,8 @@ def install_python_prereqs():
...
@@ -238,6 +242,8 @@ def install_python_prereqs():
print
NO_PREREQ_MESSAGE
print
NO_PREREQ_MESSAGE
return
return
uninstall_python_packages
()
# Include all of the requirements files in the fingerprint.
# Include all of the requirements files in the fingerprint.
files_to_fingerprint
=
list
(
PYTHON_REQ_FILES
)
files_to_fingerprint
=
list
(
PYTHON_REQ_FILES
)
...
@@ -270,5 +276,4 @@ def install_prereqs():
...
@@ -270,5 +276,4 @@ def install_prereqs():
return
return
install_node_prereqs
()
install_node_prereqs
()
uninstall_python_packages
()
install_python_prereqs
()
install_python_prereqs
()
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