Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
H
heroku-buildpack-python
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Python-Dev
heroku-buildpack-python
Commits
6faa5a4e
Commit
6faa5a4e
authored
Mar 07, 2017
by
Kenneth Reitz
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
3634eb1d
2881d65e
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
68 additions
and
8 deletions
+68
-8
.gitignore
.gitignore
+1
-0
CHANGELOG.md
CHANGELOG.md
+4
-0
compile
bin/compile
+12
-7
detect
bin/detect
+1
-1
pipenv
bin/steps/pipenv
+13
-0
pipenv-python-version
bin/steps/pipenv-python-version
+22
-0
jq
vendor/jq
+0
-0
pipstrip
vendor/pipstrip
+15
-0
No files found.
.gitignore
View file @
6faa5a4e
*.pyc
site
.DS_Store
CHANGELOG.md
View file @
6faa5a4e
# Python Buildpack Changelog
## 100
Preliminary pipenv support.
## 99
Cleanup.
...
...
bin/compile
View file @
6faa5a4e
...
...
@@ -42,7 +42,7 @@ export WARNINGS_LOG=$(mktemp)
export
RECOMMENDED_PYTHON_VERSION
=
$DEFAULT_PYTHON_VERSION
# Setup bpwatch
export
PATH
=
$PATH
:
$ROOT_DIR
/vendor/bpwatch
export
PATH
=
$PATH
:
$ROOT_DIR
/vendor/
:
$ROOT_DIR
/vendor/
bpwatch
LOGPLEX_KEY
=
"t.b90d9d29-5388-4908-9737-b4576af1d4ce"
export
BPWATCH_STORE_PATH
=
$CACHE_DIR
/bpwatch.json
BUILDPACK_VERSION
=
v28
...
...
@@ -107,12 +107,6 @@ bpwatch start pre_compile
source
$BIN_DIR
/steps/hooks/pre_compile
bpwatch stop pre_compile
# If no requirements.txt file given, assume `setup.py develop` is intended.
if
[
!
-f
requirements.txt
]
;
then
echo
"-e ."
>
requirements.txt
fi
# Sticky runtimes.
if
[
-f
$CACHE_DIR
/.heroku/python-version
]
;
then
DEFAULT_PYTHON_VERSION
=
$(
cat
$CACHE_DIR
/.heroku/python-version
)
...
...
@@ -125,6 +119,9 @@ else
CACHED_PYTHON_STACK
=
$STACK
fi
# Pipenv Python version support.
source
$BIN_DIR
/steps/pipenv-python-version
# If no runtime given, assume default version.
if
[
!
-f
runtime.txt
]
;
then
echo
$DEFAULT_PYTHON_VERSION
>
runtime.txt
...
...
@@ -172,6 +169,14 @@ source $BIN_DIR/steps/python
# Sanity check for setuptools/distribute.
source
$BIN_DIR
/steps/setuptools
# Pipenv support.
source
$BIN_DIR
/steps/pipenv
# If no requirements.txt file given, assume `setup.py develop` is intended.
if
[
!
-f
requirements.txt
]
;
then
echo
"-e ."
>
requirements.txt
fi
# Uninstall removed dependencies with Pip.
source
$BIN_DIR
/steps/pip-uninstall
...
...
bin/detect
View file @
6faa5a4e
...
...
@@ -15,7 +15,7 @@
BUILD_DIR
=
$1
# Exit early if app is clearly not Python.
if
[
!
-f
$BUILD_DIR
/requirements.txt
]
&&
[
!
-f
$BUILD_DIR
/setup.py
]
;
then
if
[
!
-f
$BUILD_DIR
/requirements.txt
]
&&
[
!
-f
$BUILD_DIR
/setup.py
]
&&
[
!
-f
$BUILD_DIR
/Pipfile
]
;
then
exit
1
fi
...
...
bin/steps/pipenv
0 → 100755
View file @
6faa5a4e
# Generate requriements.txt with pipenv.
if [[ -f Pipfile ]]; then
if [[ ! -f requirements.txt ]]; then
puts-step "Generating 'requirements.txt' with pipenv"
pip install pipenv --upgrade &> /dev/null
pipenv lock --requirements > requirements.txt 2> /dev/null
pipstrip requirements.txt
fi
fi
bin/steps/pipenv-python-version
0 → 100755
View file @
6faa5a4e
# Detect Python-version with Pipenv.
if [[ -f $BUILD_DIR/Pipfile.lock ]]; then
if [[ ! -f $BUILD_DIR/runtime.txt ]]; then
if [[ ! -f Pipfile.lock ]]; then
pipenv lock 2> /dev/null
fi
set +e
PYTHON=$(cat $BUILD_DIR/Pipfile.lock | jq '._meta.requires.python_version' -r)
set -e
if [ "$PYTHON" = 2.7 ]; then
echo "python-2.7.13" > $BUILD_DIR/runtime.txt
fi
if [ "$PYTHON" = 3.6 ]; then
echo "python-3.6.0" > $BUILD_DIR/runtime.txt
fi
fi
fi
vendor/jq
0 → 100755
View file @
6faa5a4e
File added
vendor/pipstrip
0 → 100755
View file @
6faa5a4e
#!/usr/bin/env python
import
sys
req_file
=
sys
.
argv
[
1
]
lines
=
[]
with
open
(
req_file
,
'r'
)
as
f
:
r
=
f
.
readlines
()
for
l
in
r
:
lines
.
append
(
l
.
split
(
'--hash'
)[
0
])
with
open
(
req_file
,
'w'
)
as
f
:
f
.
write
(
'
\n
'
.
join
(
lines
))
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