aboutsummaryrefslogtreecommitdiffstats
path: root/nikola/plugins/command/plugin.py
diff options
context:
space:
mode:
authorLibravatarDererk <dererk@satellogic.com>2016-11-15 14:18:53 -0300
committerLibravatarDererk <dererk@satellogic.com>2016-11-15 14:18:53 -0300
commit1ad5102b7ddd181bb9c632b124d3ea4c7db28be6 (patch)
tree73dda18465d0f4b8eb52d4482282a387c9f67c95 /nikola/plugins/command/plugin.py
parentb67294f76809a681ff73f209ed691a3e3f00563d (diff)
parentffb671c61a24a9086343b54bad080e145ff33fc5 (diff)
Merge tag 'upstream/7.8.1'
Upstream version 7.8.1 # gpg: Firmado el mar 15 nov 2016 14:18:48 ART # gpg: usando RSA clave A6C7B88B9583046A11C5403E0B00FB6CEBE2D002 # gpg: Firma correcta de "Ulises Vitulli <dererk@debian.org>" [absoluta] # gpg: alias "Dererk <dererk@torproject.org>" [absoluta] # gpg: alias "Ulises Vitulli <uvitulli@fi.uba.ar>" [absoluta] # gpg: alias "Ulises Vitulli <dererk@satellogic.com>" [absoluta]
Diffstat (limited to 'nikola/plugins/command/plugin.py')
-rw-r--r--nikola/plugins/command/plugin.py24
1 files changed, 15 insertions, 9 deletions
diff --git a/nikola/plugins/command/plugin.py b/nikola/plugins/command/plugin.py
index f892ee9..364f343 100644
--- a/nikola/plugins/command/plugin.py
+++ b/nikola/plugins/command/plugin.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2015 Roberto Alsina and others.
+# Copyright © 2012-2016 Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
@@ -29,6 +29,7 @@
from __future__ import print_function
import io
import os
+import sys
import shutil
import subprocess
import time
@@ -45,12 +46,11 @@ LOGGER = utils.get_logger('plugin', utils.STDERR_HANDLER)
class CommandPlugin(Command):
-
"""Manage plugins."""
json = None
name = "plugin"
- doc_usage = "[[-u][--user] --install name] | [[-u] [-l |--upgrade|--list-installed] | [--uninstall name]]"
+ doc_usage = "[-u url] [--user] [-i name] [-r name] [--upgrade] [-l] [--list-installed]"
doc_purpose = "manage plugins"
output_dir = None
needs_config = False
@@ -177,8 +177,11 @@ class CommandPlugin(Command):
plugins.append([plugin.name, p])
plugins.sort()
+ print('Installed Plugins:')
+ print('------------------')
for name, path in plugins:
print('{0} at {1}'.format(name, path))
+ print('\n\nAlso, you have disabled these plugins: {}'.format(self.site.config['DISABLED_PLUGINS']))
return 0
def do_upgrade(self, url):
@@ -252,7 +255,7 @@ class CommandPlugin(Command):
LOGGER.notice('This plugin has Python dependencies.')
LOGGER.info('Installing dependencies with pip...')
try:
- subprocess.check_call(('pip', 'install', '-r', reqpath))
+ subprocess.check_call((sys.executable, '-m', 'pip', 'install', '-r', reqpath))
except subprocess.CalledProcessError:
LOGGER.error('Could not install the dependencies.')
print('Contents of the requirements.txt file:\n')
@@ -293,12 +296,15 @@ class CommandPlugin(Command):
def do_uninstall(self, name):
"""Uninstall a plugin."""
for plugin in self.site.plugin_manager.getAllPlugins(): # FIXME: this is repeated thrice
- p = plugin.path
- if os.path.isdir(p):
- p = p + os.sep
- else:
- p = os.path.dirname(p)
if name == plugin.name: # Uninstall this one
+ p = plugin.path
+ if os.path.isdir(p):
+ # Plugins that have a package in them need to delete parent
+ # Issue #2356
+ p = p + os.sep
+ p = os.path.abspath(os.path.join(p, os.pardir))
+ else:
+ p = os.path.dirname(p)
LOGGER.warning('About to uninstall plugin: {0}'.format(name))
LOGGER.warning('This will delete {0}'.format(p))
sure = utils.ask_yesno('Are you sure?')