Skip to content
Permalink
Browse files

Basic untested implementation of plugin dependencies

  • Loading branch information
ralsina committed Oct 19, 2016
1 parent 8a60c09 commit cd80704d2b73c04faed5a934ed073fe8e5ccfdc0
Showing with 20 additions and 0 deletions.
  1. +20 −0 nikola/plugins/command/plugin.py
@@ -265,6 +265,7 @@ def do_install(self, url, name, show_install_notes=True):
'package manager.')
else:
LOGGER.info('Dependency installation succeeded.')

reqnpypath = os.path.join(dest_path, 'requirements-nonpy.txt')
if os.path.exists(reqnpypath):
LOGGER.notice('This plugin has third-party '
@@ -280,6 +281,25 @@ def do_install(self, url, name, show_install_notes=True):

print('You have to install those yourself or through a package '
'manager.')

req_plug_path = os.path.join(dest_path, 'requirements-plugins.txt')
if os.path.exists(req_plug_path):
LOGGER.notice('This plugin requires other nikola plugins.')
LOGGER.info('Installing plugins using Nikola...')
print('Contents of the requirements-nonpy.txt file:\n')
try:
with io.open(req_plug_path, 'r', encoding='utf-8') as inf:
for plugname in inf.readlines():
subprocess.check_call((sys.executable, '-m', 'nikola', 'plugin', '-i', reqpath))
except subprocess.CalledProcessError:
LOGGER.error('Could not install a plugin.')
print('Contents of the requirements-plugins.txt file:\n')
with io.open(reqpath, 'r', encoding='utf-8') as fh:
print(utils.indent(fh.read(), 4 * ' '))
print('You have to install those yourself manually.')
else:
LOGGER.info('Dependency installation succeeded.')

confpypath = os.path.join(dest_path, 'conf.py.sample')
if os.path.exists(confpypath) and show_install_notes:
LOGGER.notice('This plugin has a sample config file. Integrate it with yours in order to make this plugin work!')

0 comments on commit cd80704

Please sign in to comment.
You can’t perform that action at this time.