Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
persona
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hexang 息壤平台
persona
Commits
509f8657
Commit
509f8657
authored
12 years ago
by
Thomas Grainger
Browse files
Options
Downloads
Patches
Plain Diff
remove platform dependant "which" code
remove platform dependant "which" code, Now use try/catch import to check
parent
1a2a8864
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
automation-tests/run.py
+7
-19
7 additions, 19 deletions
automation-tests/run.py
with
7 additions
and
19 deletions
automation-tests/run.py
+
7
−
19
View file @
509f8657
...
...
@@ -7,23 +7,6 @@ import subprocess
import
sys
# used to check for existence of virtualenv and pip.
# lifted from: http://stackoverflow.com/questions/377017
def
which
(
program
):
def
is_exe
(
fpath
):
return
os
.
path
.
isfile
(
fpath
)
and
os
.
access
(
fpath
,
os
.
X_OK
)
fpath
,
fname
=
os
.
path
.
split
(
program
)
if
fpath
:
if
is_exe
(
program
):
return
program
else
:
for
path
in
os
.
environ
[
"
PATH
"
].
split
(
os
.
pathsep
):
exe_file
=
os
.
path
.
join
(
path
,
program
)
if
is_exe
(
exe_file
):
return
exe_file
return
None
def
main
():
# get path to python: virtualenv location differs on windows
# TODO platform detection is brittle. is there a better way?
...
...
@@ -64,11 +47,16 @@ def main():
exit
(
1
)
# 2. check that virtualenv and pip exist. if not, bail.
if
not
which
(
'
pip
'
):
try
:
import
pip
except
ImportError
:
sys
.
stderr
.
write
(
'
pip must be installed; do
"
easy_install pip
"
,
'
+
'
then try again
\n
'
)
exit
(
1
)
if
not
which
(
'
virtualenv
'
):
try
:
import
virtualenv
except
ImportError
:
sys
.
stderr
.
write
(
'
virtualenv must be installed; do
"
pip install
'
+
'
virtualenv
"
, then try again
\n
'
)
exit
(
1
)
...
...
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