Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
configuration
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
OpenEdx
configuration
Commits
2eb9302c
Commit
2eb9302c
authored
May 16, 2013
by
John Jarvis
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #79 from edx/jarv/fab-new-requirements
new directory structure for requirements
parents
72849fe6
51ee4093
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
9 deletions
+35
-9
fabfile/git.py
+35
-9
No files found.
fabfile/git.py
View file @
2eb9302c
...
...
@@ -24,6 +24,10 @@ from .timestamps import no_ts
REPO_URL
=
'git@github.com:{}/{}'
REPO_DIRNAME
=
'/opt/wwc'
GIT_USER
=
"www-data"
AA_COMPLAIN
=
'/usr/sbin/aa-complain'
AA_ENFORCE
=
'/usr/sbin/aa-enforce'
AA_SANDBOX_POLICY
=
'/etc/apparmor.d/code.sandbox'
VIRTUAL_ENVS
=
[
'/opt/edx'
,
'/opt/edx-sandbox'
]
@task
(
default
=
True
,
aliases
=
[
'deploy'
])
...
...
@@ -363,25 +367,47 @@ def _install_requirements(pkg):
if they exists for the repo.
will not run pip install if the requirements file
has not changed since the last run
Turns off apparmor enforcement during pip install
for the sandbox virtualenv
"""
def
pip_install
(
file
):
def
pip_install
(
file
,
venv
=
'/opt/edx'
):
with
prefix
(
"export GIT_SSH=/tmp/git.sh"
):
with
prefix
(
'source
/opt/edx/bin/activate'
):
with
prefix
(
'source
{}'
.
format
(
os
.
path
.
join
(
venv
,
'bin/activate'
))
):
with
prefix
(
'export PIP_DOWNLOAD_CACHE=/tmp/pip_download_cache'
):
noopable
(
sudo
)(
'pip install --exists-action w -r {0}'
.
format
(
file
))
# Run old-style requirements
if
files
.
exists
(
AA_COMPLAIN
)
and
files
.
exists
(
AA_SANDBOX_POLICY
):
# in order to install code-sandbox requirements the
# code sandbox apparmor policy must be temporarily
# suspended
sudo
(
'{0} {1}'
.
format
(
AA_COMPLAIN
,
AA_SANDBOX_POLICY
))
# Run old-style requirements TODO: remove
_run_if_changed
(
pkg
,
'pre-requirements.txt'
,
partial
(
pip_install
,
'pre-requirements.txt'
))
pip_install
,
file
=
'pre-requirements.txt'
,
venv
=
'/opt/edx'
),
'cat *requirements.txt'
)
_run_if_changed
(
pkg
,
'requirements.txt'
,
partial
(
pip_install
,
'requirements.txt'
),
'cat *requirements.txt'
)
pip_install
,
file
=
'requirements.txt'
,
venv
=
'/opt/edx'
),
'cat *requirements.txt'
)
# end old-style requirements
# Run new-style requirements
_run_if_changed
(
pkg
,
'requirements/base.txt'
,
partial
(
pip_install
,
'requirements/base.txt'
),
'cat requirements/*.txt'
)
_run_if_changed
(
pkg
,
'requirements/post.txt'
,
partial
(
pip_install
,
'requirements/post.txt'
))
for
venv
in
VIRTUAL_ENVS
:
if
not
files
.
exists
(
venv
):
# skip if the virtualenv doesn't exist
continue
venv_name
=
os
.
path
.
basename
(
venv
)
pip_cmd_base
=
partial
(
pip_install
,
file
=
'requirements/{}/base.txt'
.
format
(
venv_name
),
venv
=
venv
)
pip_cmd_post
=
partial
(
pip_install
,
file
=
'requirements/{}/post.txt'
.
format
(
venv_name
),
venv
=
venv
)
_run_if_changed
(
pkg
,
'requirements/{}/base.txt'
.
format
(
venv_name
),
pip_cmd_base
,
'cat requirements/{}/*.txt'
.
format
(
venv_name
))
_run_if_changed
(
pkg
,
'requirements/{}/post.txt'
.
format
(
venv_name
),
pip_cmd_post
,
'cat requirements/{}/*.txt'
.
format
(
venv_name
))
if
files
.
exists
(
AA_ENFORCE
)
and
files
.
exists
(
AA_SANDBOX_POLICY
):
sudo
(
'{0} {1}'
.
format
(
AA_ENFORCE
,
AA_SANDBOX_POLICY
))
@task
...
...
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