Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
Kolla Ansible
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Very Demiurge Very Mindful
Kolla Ansible
Commits
7e5db84e
Commit
7e5db84e
authored
3 years ago
by
Zuul
Committed by
Gerrit Code Review
3 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Support editable installation in all cases"
parents
91d67b08
22a6765f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/kolla-ansible
+23
-5
23 additions, 5 deletions
tools/kolla-ansible
with
23 additions
and
5 deletions
tools/kolla-ansible
+
23
−
5
View file @
7e5db84e
...
...
@@ -22,6 +22,7 @@ function check_environment_coherence {
local
ansible_python_cmdline
# NOTE(yoctozepto): may have multiple parts
ansible_python_cmdline
=
${
ansible_shebang_line
#\#\!
}
ansible_python_version
=
$(
$ansible_python_cmdline
-c
'import sys; print(str(sys.version_info[0])+"."+str(sys.version_info[1]))'
)
if
!
$ansible_python_cmdline
--version
&>/dev/null
;
then
echo
"ERROR: Ansible Python is not functional."
>
&2
...
...
@@ -66,21 +67,38 @@ function check_environment_coherence {
function
find_base_dir
{
local
dir_name
local
python_dir
dir_name
=
$(
dirname
"
$0
"
)
# NOTE(yoctozepto): Fix the case where dir_name is a symlink and VIRTUAL_ENV might not be. This
# happens with pyenv-virtualenv, see https://bugs.launchpad.net/kolla-ansible/+bug/1903887
dir_name
=
$(
readlink
-e
"
$dir_name
"
)
python_dir
=
"python
${
ansible_python_version
}
"
if
[
-z
"
$SNAP
"
]
;
then
if
[[
${
dir_name
}
==
"/usr/bin"
]]
;
then
BASEDIR
=
/usr/share/kolla-ansible
if
test
-f
/usr/lib/
${
python_dir
}
/
*
-packages
/kolla-ansible.egg-link
;
then
# Editable install.
BASEDIR
=
"
$(
head
-n1
/usr/lib/
${
python_dir
}
/
*
-packages
/kolla-ansible.egg-link
)
"
else
BASEDIR
=
/usr/share/kolla-ansible
fi
elif
[[
${
dir_name
}
==
"/usr/local/bin"
]]
;
then
BASEDIR
=
/usr/local/share/kolla-ansible
if
test
-f
/usr/local/lib/
${
python_dir
}
/
*
-packages
/kolla-ansible.egg-link
;
then
# Editable install.
BASEDIR
=
"
$(
head
-n1
/usr/local/lib/
${
python_dir
}
/
*
-packages
/kolla-ansible.egg-link
)
"
else
BASEDIR
=
/usr/local/share/kolla-ansible
fi
elif
[[
${
dir_name
}
==
~/.local/bin
]]
;
then
BASEDIR
=
~/.local/share/kolla-ansible
if
test
-f
~/.local/lib/
${
python_dir
}
/
*
-packages
/kolla-ansible.egg-link
;
then
# Editable install.
BASEDIR
=
"
$(
head
-n1
~/.local/lib/
${
python_dir
}
/
*
-packages
/kolla-ansible.egg-link
)
"
else
BASEDIR
=
~/.local/share/kolla-ansible
fi
elif
[[
-n
${
VIRTUAL_ENV
}
]]
&&
[[
${
dir_name
}
==
"
$(
readlink
-e
"
${
VIRTUAL_ENV
}
/bin"
)
"
]]
;
then
if
test
-f
${
VIRTUAL_ENV
}
/lib/python
*
/site-packages/kolla-ansible.egg-link
;
then
if
test
-f
${
VIRTUAL_ENV
}
/lib/
${
python
_dir
}
/site-packages/kolla-ansible.egg-link
;
then
# Editable install.
BASEDIR
=
"
$(
head
-n1
${
VIRTUAL_ENV
}
/lib/python
*
/site
-packages/kolla-ansible.egg-link
)
"
BASEDIR
=
"
$(
head
-n1
${
VIRTUAL_ENV
}
/lib/
${
python
_dir
}
/
*
-packages
/kolla-ansible.egg-link
)
"
else
BASEDIR
=
"
${
VIRTUAL_ENV
}
/share/kolla-ansible"
fi
...
...
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