Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: getnikola/nikola
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 6e2776bbd9cc
Choose a base ref
...
head repository: getnikola/nikola
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 9a9d7c2a3008
Choose a head ref
  • 2 commits
  • 3 files changed
  • 1 contributor

Commits on Apr 24, 2015

  1. [TEMPORARY] disable Commands

    Signed-off-by: Chris Warrick <kwpolska@gmail.com>
    Kwpolska committed Apr 24, 2015
    Copy the full SHA
    299680b View commit details
  2. fix nikola check (hacky!)

    Signed-off-by: Chris Warrick <kwpolska@gmail.com>
    Kwpolska committed Apr 24, 2015
    Copy the full SHA
    9a9d7c2 View commit details
Showing with 10 additions and 11 deletions.
  1. +1 −0 nikola/plugin_categories.py
  2. +8 −10 nikola/plugins/command/check.py
  3. +1 −1 nikola/utils.py
1 change: 1 addition & 0 deletions nikola/plugin_categories.py
Original file line number Diff line number Diff line change
@@ -94,6 +94,7 @@ def __init__(self, *args, **kwargs):
DoitCommand.__init__(self)

def __call__(self, config=None, **kwargs):
self._doitargs = kwargs
DoitCommand.__init__(self, config, **kwargs)
return self

18 changes: 8 additions & 10 deletions nikola/plugins/command/check.py
Original file line number Diff line number Diff line change
@@ -40,9 +40,7 @@
from nikola.utils import get_logger


def _call_nikola_list(site, arguments):
l = site.doit.sub_cmds['list']

def _call_nikola_list(l, site, arguments):
class NotReallyAStream(object):
"""A massive hack."""
out = []
@@ -60,12 +58,12 @@ def write(self, t):
l.outstream = oldstream


def real_scan_files(site):
def real_scan_files(l, site):
task_fnames = set([])
real_fnames = set([])
output_folder = site.config['OUTPUT_FOLDER']
# First check that all targets are generated in the right places
for task in _call_nikola_list(site, ["--all"]):
for task in _call_nikola_list(l, site, ["--all"]):
task = task.strip()
if output_folder in task and ':' in task:
fname = task.split(':', 1)[-1]
@@ -143,8 +141,8 @@ class CommandCheck(Command):

def _execute(self, options, args):
"""Check the generated site."""

self.logger = get_logger('check', self.site.loghandlers)
self.l = self._doitargs['cmds']['list'](config=self.config, **self._doitargs)

if not options['links'] and not options['files'] and not options['clean']:
print(self.help())
@@ -230,7 +228,7 @@ def analyze(self, task, find_sources=False):
self.logger.warn("Broken link in {0}: {1}".format(filename, target))
if find_sources:
self.logger.warn("Possible sources:")
self.logger.warn("\n".join(_call_nikola_list(self.site, ["--deps", task])))
self.logger.warn("\n".join(_call_nikola_list(self.l, self.site, ["--deps", task])))
self.logger.warn("===============================\n")
except Exception as exc:
self.logger.error("Error with: {0} {1}".format(filename, exc))
@@ -241,7 +239,7 @@ def scan_links(self, find_sources=False):
self.logger.info("===============\n")
self.logger.notice("{0} mode".format(self.site.config['URL_TYPE']))
failure = False
for task in _call_nikola_list(self.site, ["--all"]):
for task in _call_nikola_list(self.l, self.site, ["--all"]):
task = task.strip()
if task.split(':')[0] in (
'render_tags', 'render_archive',
@@ -258,7 +256,7 @@ def scan_files(self):
failure = False
self.logger.info("Checking Files:")
self.logger.info("===============\n")
only_on_output, only_on_input = real_scan_files(self.site)
only_on_output, only_on_input = real_scan_files(self.l, self.site)

# Ignore folders
only_on_output = [p for p in only_on_output if not os.path.isdir(p)]
@@ -280,7 +278,7 @@ def scan_files(self):
return failure

def clean_files(self):
only_on_output, _ = real_scan_files(self.site)
only_on_output, _ = real_scan_files(self.l, self.site)
for f in only_on_output:
os.unlink(f)
return True
2 changes: 1 addition & 1 deletion nikola/utils.py
Original file line number Diff line number Diff line change
@@ -1308,7 +1308,7 @@ class Commands(object):
def __init__(self, main):
"""Takes a main instance, works as wrapper for commands."""
self._cmdnames = []
for k, v in main.get_commands().items():
for k, v in {}.items(): # main.get_commands().items():
self._cmdnames.append(k)
if k in ['run', 'init']:
continue