diff options
| author | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-07-17 17:46:37 -0400 |
|---|---|---|
| committer | Jonathan Corbet <corbet@lwn.net> | 2017-07-23 17:51:10 -0400 |
| commit | 5be33182d4e22750237281f03172e6c3456cdb42 (patch) | |
| tree | 60c007248d9a9882b3535ca13868393157e37585 /scripts/sphinx-pre-install | |
| parent | 24071ac1a6176dda89b441cc4c757c51e2f523e0 (diff) | |
sphinx-pre-install: detect an existing virtualenv
Detect if the script runs after creating the virtualenv,
printing the command line commands to enable the virtualenv.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'scripts/sphinx-pre-install')
| -rwxr-xr-x | scripts/sphinx-pre-install | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/scripts/sphinx-pre-install b/scripts/sphinx-pre-install index 5fe3b4a86174..bcd6f7978f8d 100755 --- a/scripts/sphinx-pre-install +++ b/scripts/sphinx-pre-install | |||
| @@ -13,6 +13,8 @@ use strict; | |||
| 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | # GNU General Public License for more details. | 14 | # GNU General Public License for more details. |
| 15 | 15 | ||
| 16 | my $virtenv_dir = "sphinx_1.4"; | ||
| 17 | |||
| 16 | # | 18 | # |
| 17 | # Static vars | 19 | # Static vars |
| 18 | # | 20 | # |
| @@ -454,16 +456,22 @@ sub check_needs() | |||
| 454 | which("sphinx-build-3"); | 456 | which("sphinx-build-3"); |
| 455 | } | 457 | } |
| 456 | if ($need_sphinx) { | 458 | if ($need_sphinx) { |
| 457 | my $virtualenv = findprog("virtualenv-3"); | 459 | my $activate = "$virtenv_dir/bin/activate"; |
| 458 | $virtualenv = findprog("virtualenv") if (!$virtualenv); | 460 | if (-e "$ENV{'PWD'}/$activate") { |
| 459 | $virtualenv = "virtualenv" if (!$virtualenv); | 461 | printf "\nNeed to activate virtualenv with:\n"; |
| 460 | 462 | printf "\t. $activate\n"; | |
| 461 | printf "\t$virtualenv sphinx_1.4\n"; | 463 | } else { |
| 462 | printf "\t. sphinx_1.4/bin/activate\n"; | 464 | my $virtualenv = findprog("virtualenv-3"); |
| 463 | printf "\tpip install 'docutils==0.12'\n"; | 465 | $virtualenv = findprog("virtualenv") if (!$virtualenv); |
| 464 | printf "\tpip install 'Sphinx==1.4.9'\n"; | 466 | $virtualenv = "virtualenv" if (!$virtualenv); |
| 465 | printf "\tpip install sphinx_rtd_theme\n"; | 467 | |
| 466 | $need++; | 468 | printf "\t$virtualenv $virtenv_dir\n"; |
| 469 | printf "\t. $activate\n"; | ||
| 470 | printf "\tpip install 'docutils==0.12'\n"; | ||
| 471 | printf "\tpip install 'Sphinx==1.4.9'\n"; | ||
| 472 | printf "\tpip install sphinx_rtd_theme\n"; | ||
| 473 | $need++; | ||
| 474 | } | ||
| 467 | } | 475 | } |
| 468 | printf "\n"; | 476 | printf "\n"; |
| 469 | 477 | ||
