Skip to content

Commit 385425a

Browse files
author
SCLorg Jenkins
committed
auto-sync: master commit 89e5d59
1 parent 2052460 commit 385425a

6 files changed

Lines changed: 60 additions & 45 deletions

File tree

2.7/s2i/bin/assemble

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ set -e
3535

3636
shopt -s dotglob
3737
echo "---> Installing application source ..."
38-
mv /tmp/src/* ./
38+
mv /tmp/src/* "$HOME"
3939

4040
if [[ ! -z "$UPGRADE_PIP_TO_LATEST" || ! -z "$ENABLE_PIPENV" ]]; then
4141
echo "---> Upgrading pip to latest version ..."
@@ -65,10 +65,13 @@ if should_collectstatic; then
6565
(
6666
echo "---> Collecting Django static files ..."
6767

68+
APP_HOME=$(readlink -f "${APP_HOME:-.}")
69+
# Change the working directory to APP_HOME
70+
PYTHONPATH="$(pwd)${PYTHONPATH:+:$PYTHONPATH}"
71+
cd "$APP_HOME"
6872

69-
APP_HOME=${APP_HOME:-.}
70-
# Look for 'manage.py' in the directory specified by APP_HOME, or the current directory
71-
manage_file=$APP_HOME/manage.py
73+
# Look for 'manage.py' in the current directory
74+
manage_file=./manage.py
7275

7376
if [[ ! -f "$manage_file" ]]; then
7477
echo "WARNING: seems that you're using Django, but we could not find a 'manage.py' file."

2.7/s2i/bin/run

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ function get_default_web_concurrency() {
3535
echo $default
3636
}
3737

38+
APP_HOME=$(readlink -f "${APP_HOME:-.}")
39+
# Change the working directory to APP_HOME
40+
PYTHONPATH="$(pwd)${PYTHONPATH:+:$PYTHONPATH}"
41+
cd "$APP_HOME"
42+
3843
app_script_check="${APP_SCRIPT-}"
3944
APP_SCRIPT="${APP_SCRIPT-app.sh}"
4045
if [[ -f "$APP_SCRIPT" ]]; then
@@ -56,9 +61,8 @@ else
5661
test -n "$app_file_check" && (>&2 echo "ERROR: file '$app_file_check' not found.") && exit 1
5762
fi
5863

59-
APP_HOME=${APP_HOME:-.}
60-
# Look for 'manage.py' in the directory specified by APP_HOME, or the current direcotry
61-
manage_file=$APP_HOME/manage.py
64+
# Look for 'manage.py' in the current directory
65+
manage_file=./manage.py
6266

6367
if should_migrate; then
6468
if [[ -f "$manage_file" ]]; then
@@ -71,14 +75,12 @@ if should_migrate; then
7175
fi
7276

7377
if is_gunicorn_installed; then
74-
if [[ -z "$APP_MODULE" ]]; then
75-
# Look only in the directory specified by APP_HOME, or the current directory
76-
# replace all "/" with ".", remove leading "." and ".py" suffix
77-
APP_MODULE=$(find $APP_HOME -maxdepth 1 -type f -name 'wsgi.py' | sed 's:/:.:g;s:^\.\+::;s:\.py$::')
78-
fi
79-
80-
if [[ -z "$APP_MODULE" && -f setup.py ]]; then
81-
APP_MODULE="$(python setup.py --name)"
78+
setup_py=$(find "$HOME" -maxdepth 2 -type f -name 'setup.py' -print -quit)
79+
# Look for wsgi module in the current directory
80+
if [[ -z "$APP_MODULE" && -f "./wsgi.py" ]]; then
81+
APP_MODULE=wsgi
82+
elif [[ -z "$APP_MODULE" && -f "$setup_py" ]]; then
83+
APP_MODULE="$(python "$setup_py" --name)"
8284
fi
8385

8486
if [[ "$APP_MODULE" ]]; then

3.5/s2i/bin/assemble

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ set -e
3535

3636
shopt -s dotglob
3737
echo "---> Installing application source ..."
38-
mv /tmp/src/* ./
38+
mv /tmp/src/* "$HOME"
3939

4040
if [[ ! -z "$UPGRADE_PIP_TO_LATEST" || ! -z "$ENABLE_PIPENV" ]]; then
4141
echo "---> Upgrading pip to latest version ..."
@@ -65,10 +65,13 @@ if should_collectstatic; then
6565
(
6666
echo "---> Collecting Django static files ..."
6767

68+
APP_HOME=$(readlink -f "${APP_HOME:-.}")
69+
# Change the working directory to APP_HOME
70+
PYTHONPATH="$(pwd)${PYTHONPATH:+:$PYTHONPATH}"
71+
cd "$APP_HOME"
6872

69-
APP_HOME=${APP_HOME:-.}
70-
# Look for 'manage.py' in the directory specified by APP_HOME, or the current directory
71-
manage_file=$APP_HOME/manage.py
73+
# Look for 'manage.py' in the current directory
74+
manage_file=./manage.py
7275

7376
if [[ ! -f "$manage_file" ]]; then
7477
echo "WARNING: seems that you're using Django, but we could not find a 'manage.py' file."

3.5/s2i/bin/run

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ function get_default_web_concurrency() {
3535
echo $default
3636
}
3737

38+
APP_HOME=$(readlink -f "${APP_HOME:-.}")
39+
# Change the working directory to APP_HOME
40+
PYTHONPATH="$(pwd)${PYTHONPATH:+:$PYTHONPATH}"
41+
cd "$APP_HOME"
42+
3843
app_script_check="${APP_SCRIPT-}"
3944
APP_SCRIPT="${APP_SCRIPT-app.sh}"
4045
if [[ -f "$APP_SCRIPT" ]]; then
@@ -56,9 +61,8 @@ else
5661
test -n "$app_file_check" && (>&2 echo "ERROR: file '$app_file_check' not found.") && exit 1
5762
fi
5863

59-
APP_HOME=${APP_HOME:-.}
60-
# Look for 'manage.py' in the directory specified by APP_HOME, or the current direcotry
61-
manage_file=$APP_HOME/manage.py
64+
# Look for 'manage.py' in the current directory
65+
manage_file=./manage.py
6266

6367
if should_migrate; then
6468
if [[ -f "$manage_file" ]]; then
@@ -71,14 +75,12 @@ if should_migrate; then
7175
fi
7276

7377
if is_gunicorn_installed; then
74-
if [[ -z "$APP_MODULE" ]]; then
75-
# Look only in the directory specified by APP_HOME, or the current directory
76-
# replace all "/" with ".", remove leading "." and ".py" suffix
77-
APP_MODULE=$(find $APP_HOME -maxdepth 1 -type f -name 'wsgi.py' | sed 's:/:.:g;s:^\.\+::;s:\.py$::')
78-
fi
79-
80-
if [[ -z "$APP_MODULE" && -f setup.py ]]; then
81-
APP_MODULE="$(python setup.py --name)"
78+
setup_py=$(find "$HOME" -maxdepth 2 -type f -name 'setup.py' -print -quit)
79+
# Look for wsgi module in the current directory
80+
if [[ -z "$APP_MODULE" && -f "./wsgi.py" ]]; then
81+
APP_MODULE=wsgi
82+
elif [[ -z "$APP_MODULE" && -f "$setup_py" ]]; then
83+
APP_MODULE="$(python "$setup_py" --name)"
8284
fi
8385

8486
if [[ "$APP_MODULE" ]]; then

3.6/s2i/bin/assemble

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ set -e
3434

3535
shopt -s dotglob
3636
echo "---> Installing application source ..."
37-
mv /tmp/src/* ./
37+
mv /tmp/src/* "$HOME"
3838

3939
if [[ ! -z "$UPGRADE_PIP_TO_LATEST" ]]; then
4040
echo "---> Upgrading pip to latest version ..."
@@ -64,10 +64,13 @@ if should_collectstatic; then
6464
(
6565
echo "---> Collecting Django static files ..."
6666

67+
APP_HOME=$(readlink -f "${APP_HOME:-.}")
68+
# Change the working directory to APP_HOME
69+
PYTHONPATH="$(pwd)${PYTHONPATH:+:$PYTHONPATH}"
70+
cd "$APP_HOME"
6771

68-
APP_HOME=${APP_HOME:-.}
69-
# Look for 'manage.py' in the directory specified by APP_HOME, or the current directory
70-
manage_file=$APP_HOME/manage.py
72+
# Look for 'manage.py' in the current directory
73+
manage_file=./manage.py
7174

7275
if [[ ! -f "$manage_file" ]]; then
7376
echo "WARNING: seems that you're using Django, but we could not find a 'manage.py' file."

3.6/s2i/bin/run

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ function get_default_web_concurrency() {
3535
echo $default
3636
}
3737

38+
APP_HOME=$(readlink -f "${APP_HOME:-.}")
39+
# Change the working directory to APP_HOME
40+
PYTHONPATH="$(pwd)${PYTHONPATH:+:$PYTHONPATH}"
41+
cd "$APP_HOME"
42+
3843
app_script_check="${APP_SCRIPT-}"
3944
APP_SCRIPT="${APP_SCRIPT-app.sh}"
4045
if [[ -f "$APP_SCRIPT" ]]; then
@@ -56,9 +61,8 @@ else
5661
test -n "$app_file_check" && (>&2 echo "ERROR: file '$app_file_check' not found.") && exit 1
5762
fi
5863

59-
APP_HOME=${APP_HOME:-.}
60-
# Look for 'manage.py' in the directory specified by APP_HOME, or the current direcotry
61-
manage_file=$APP_HOME/manage.py
64+
# Look for 'manage.py' in the current directory
65+
manage_file=./manage.py
6266

6367
if should_migrate; then
6468
if [[ -f "$manage_file" ]]; then
@@ -71,14 +75,12 @@ if should_migrate; then
7175
fi
7276

7377
if is_gunicorn_installed; then
74-
if [[ -z "$APP_MODULE" ]]; then
75-
# Look only in the directory specified by APP_HOME, or the current directory
76-
# replace all "/" with ".", remove leading "." and ".py" suffix
77-
APP_MODULE=$(find $APP_HOME -maxdepth 1 -type f -name 'wsgi.py' | sed 's:/:.:g;s:^\.\+::;s:\.py$::')
78-
fi
79-
80-
if [[ -z "$APP_MODULE" && -f setup.py ]]; then
81-
APP_MODULE="$(python setup.py --name)"
78+
setup_py=$(find "$HOME" -maxdepth 2 -type f -name 'setup.py' -print -quit)
79+
# Look for wsgi module in the current directory
80+
if [[ -z "$APP_MODULE" && -f "./wsgi.py" ]]; then
81+
APP_MODULE=wsgi
82+
elif [[ -z "$APP_MODULE" && -f "$setup_py" ]]; then
83+
APP_MODULE="$(python "$setup_py" --name)"
8284
fi
8385

8486
if [[ "$APP_MODULE" ]]; then

0 commit comments

Comments
 (0)