Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
heroku-buildpack-python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Evili del Rio i Silvan
heroku-buildpack-python
Commits
e82f1e4d
Unverified
Commit
e82f1e4d
authored
6 years ago
by
Terence Lee
Browse files
Options
Downloads
Patches
Plain Diff
add Python version operators
parent
f7e59300
Branches
master
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bin/utils
+27
-0
27 additions, 0 deletions
bin/utils
with
27 additions
and
0 deletions
bin/utils
+
27
−
0
View file @
e82f1e4d
...
...
@@ -58,3 +58,30 @@ measure-size() {
echo
"
$(
du
-s
.heroku/python 2>/dev/null
||
echo
0
)
| awk '{print
$1
}')"
}
# Python version operator >
version_gt
()
{
test
"
$(
printf
'%s\n'
"
$@
"
|
sort
-V
|
head
-n
1
)
"
!=
"
$1
"
;
}
# Python verison operator >=
version_gte
()
{
if
[
"
$1
"
==
"
$2
"
]
;
then
return
0
fi
version_gt
"
$1
"
"
$2
"
}
# Check if Python 2
python2_check
()
{
VERSION
=
"
$1
"
version_gte
"
$VERSION
"
"python-2.7.0"
&&
version_gt
"python-3.0.0"
"
$VERSION
"
}
# Check if Python 3
python3_check
()
{
VERSION
=
"
$1
"
version_gte
"
$VERSION
"
"python-3.0.0"
&&
version_gt
"python-4.0.0"
"
$VERSION
"
}
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