Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing pelican executable #3354

Open
2 tasks done
egberts opened this issue Jun 30, 2024 · 1 comment
Open
2 tasks done

Missing pelican executable #3354

egberts opened this issue Jun 30, 2024 · 1 comment

Comments

@egberts
Copy link
Contributor

egberts commented Jun 30, 2024

  • I have read the Filing Issues and subsequent “How to Get Help” sections of the documentation.
  • I have searched the issues (including closed ones) and believe that this is not a duplicate.

Issue

The pelican executable is missing.

Often times, development works entails testing Pelican as NOT BEING INSTALLED (also no virtual environment too). Having to supply the missing pelican executable becomes a necessary step. Many development works are done without the installation effort as part of the rapid but streamlined prototyping effort:

  • Edit the Python/CSS/HTML or document file
  • Run pelican
  • Repeat

Notice no installation (nor invoke build) required.

This is most useful and ideal scenario in many IDE platforms. Also, it would make plugin development easier from the command line (CLI).

Suggested pelican Python file:

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import sys
import logging
from pelican.__main__ import main


class StdinFilter(logging.Filter):
    def filter(self, rec):
        return rec.levelno in (logging.DEBUG, logging.INFO)

class StderrFilter(logging.Filter):
    def filter(self, rec):
        return rec.levelno in (logging.WARNING, logging.FATAL, logging.CRITICAL)

logger = logging.getLogger("__name__")
logger.setLevel(logging.DEBUG)

h1 = logging.StreamHandler(sys.stdout)
h1.setLevel(logging.DEBUG)
h1.addFilter(StdinFilter())
h2 = logging.StreamHandler(sys.stderr)
h2.addFilter(StderrFilter())
h2.setLevel(logging.WARNING)

logger.addHandler(h1)  # DEBUG/INFO
logger.addHandler(h2)  # WARNING/FATAL/CRITICAL

if __name__ == "__main__":
    sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0])
    sys.exit(main())

Platform Used

  • OS version and name: Linux 6.1.0-21-amd64 SMP PREEMPT_DYNAMIC Debian 6.1.90-1 (2024-05-03) x86_64 GNU/Linux
  • Python version: 3.11.2
  • Pelican version: HEAD (513abbf)
  • Link to theme: m.css
  • Links to plugins: pelican-plugins
  • Link to your site: n/a
  • Link to your source: n/a
@egberts egberts added the bug label Jun 30, 2024
@justinmayer justinmayer removed the bug label Jul 2, 2024
@egberts
Copy link
Contributor Author

egberts commented Jul 10, 2024

If not installed, but testing... the following log message in server.py is also invalid because the pelican executable is .... not yet installed (evaluation mode as often done by newcomers willing to try Pelican).

    logger.warning(
        "'python -m pelican.server' is deprecated.\nThe "
        "Pelican development server should be run via "
        "'pelican --listen' or 'pelican -l'.\nThis can be combined "
        "with regeneration as 'pelican -lr'.\nRerun 'pelican-"
        "quickstart' to get new Makefile and tasks.py files."
    )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants