Unpacking Software Livestream

Join our monthly Unpacking Software livestream to hear about the latest news, chat and opinion on packaging, software deployment and lifecycle management!

Learn More

Chocolatey Product Spotlight

Join the Chocolatey Team on our regular monthly stream where we put a spotlight on the most recent Chocolatey product releases. You'll have a chance to have your questions answered in a live Ask Me Anything format.

Learn More

Chocolatey Coding Livestream

Join us for the Chocolatey Coding Livestream, where members of our team dive into the heart of open source development by coding live on various Chocolatey projects. Tune in to witness real-time coding, ask questions, and gain insights into the world of package management. Don't miss this opportunity to engage with our team and contribute to the future of Chocolatey!

Learn More

Calling All Chocolatiers! Whipping Up Windows Automation with Chocolatey Central Management

Webinar from
Wednesday, 17 January 2024

We are delighted to announce the release of Chocolatey Central Management v0.12.0, featuring seamless Deployment Plan creation, time-saving duplications, insightful Group Details, an upgraded Dashboard, bug fixes, user interface polishing, and refined documentation. As an added bonus we'll have members of our Solutions Engineering team on-hand to dive into some interesting ways you can leverage the new features available!

Watch On-Demand
Chocolatey Community Coffee Break

Join the Chocolatey Team as we discuss all things Community, what we do, how you can get involved and answer your Chocolatey questions.

Watch The Replays
Chocolatey and Intune Overview

Webinar Replay from
Wednesday, 30 March 2022

At Chocolatey Software we strive for simple, and teaching others. Let us teach you just how simple it could be to keep your 3rd party applications updated across your devices, all with Intune!

Watch On-Demand
Chocolatey For Business. In Azure. In One Click.

Livestream from
Thursday, 9 June 2022

Join James and Josh to show you how you can get the Chocolatey For Business recommended infrastructure and workflow, created, in Azure, in around 20 minutes.

Watch On-Demand
The Future of Chocolatey CLI

Livestream from
Thursday, 04 August 2022

Join Paul and Gary to hear more about the plans for the Chocolatey CLI in the not so distant future. We'll talk about some cool new features, long term asks from Customers and Community and how you can get involved!

Watch On-Demand
Hacktoberfest Tuesdays 2022

Livestreams from
October 2022

For Hacktoberfest, Chocolatey ran a livestream every Tuesday! Re-watch Cory, James, Gary, and Rain as they share knowledge on how to contribute to open-source projects such as Chocolatey CLI.

Watch On-Demand

Downloads:

458

Downloads of v 3.2.0:

315

Last Update:

26 Oct 2020

Package Maintainer(s):

Software Author(s):

  • The Lektor Team

Tags:

python virtualenv cms

lektor

  • 1
  • 2
  • 3

3.2.0 | Updated: 26 Oct 2020

Downloads:

458

Downloads of v 3.2.0:

315

Maintainer(s):

Software Author(s):

  • The Lektor Team

lektor 3.2.0

  • 1
  • 2
  • 3

All Checks are Passing

3 Passing Tests


Validation Testing Passed


Verification Testing Passed

Details

Scan Testing Successful:

No detections found in any package files

Details
Learn More

Deployment Method: Individual Install, Upgrade, & Uninstall

To install lektor, run the following command from the command line or from PowerShell:

>

To upgrade lektor, run the following command from the command line or from PowerShell:

>

To uninstall lektor, run the following command from the command line or from PowerShell:

>

Deployment Method:

NOTE

This applies to both open source and commercial editions of Chocolatey.

1. Enter Your Internal Repository Url

(this should look similar to https://community.chocolatey.org/api/v2/)


2. Setup Your Environment

1. Ensure you are set for organizational deployment

Please see the organizational deployment guide

2. Get the package into your environment

  • Open Source or Commercial:
    • Proxy Repository - Create a proxy nuget repository on Nexus, Artifactory Pro, or a proxy Chocolatey repository on ProGet. Point your upstream to https://community.chocolatey.org/api/v2/. Packages cache on first access automatically. Make sure your choco clients are using your proxy repository as a source and NOT the default community repository. See source command for more information.
    • You can also just download the package and push it to a repository Download

3. Copy Your Script

choco upgrade lektor -y --source="'INTERNAL REPO URL'" [other options]

See options you can pass to upgrade.

See best practices for scripting.

Add this to a PowerShell script or use a Batch script with tools and in places where you are calling directly to Chocolatey. If you are integrating, keep in mind enhanced exit codes.

If you do use a PowerShell script, use the following to ensure bad exit codes are shown as failures:


choco upgrade lektor -y --source="'INTERNAL REPO URL'" 
$exitCode = $LASTEXITCODE

Write-Verbose "Exit code was $exitCode"
$validExitCodes = @(0, 1605, 1614, 1641, 3010)
if ($validExitCodes -contains $exitCode) {
  Exit 0
}

Exit $exitCode

- name: Install lektor
  win_chocolatey:
    name: lektor
    version: '3.2.0'
    source: INTERNAL REPO URL
    state: present

See docs at https://docs.ansible.com/ansible/latest/modules/win_chocolatey_module.html.


chocolatey_package 'lektor' do
  action    :install
  source   'INTERNAL REPO URL'
  version  '3.2.0'
end

See docs at https://docs.chef.io/resource_chocolatey_package.html.


cChocoPackageInstaller lektor
{
    Name     = "lektor"
    Version  = "3.2.0"
    Source   = "INTERNAL REPO URL"
}

Requires cChoco DSC Resource. See docs at https://github.com/chocolatey/cChoco.


package { 'lektor':
  ensure   => '3.2.0',
  provider => 'chocolatey',
  source   => 'INTERNAL REPO URL',
}

Requires Puppet Chocolatey Provider module. See docs at https://forge.puppet.com/puppetlabs/chocolatey.


4. If applicable - Chocolatey configuration/installation

See infrastructure management matrix for Chocolatey configuration elements and examples.

Package Approved

This package was approved by moderator mwallner on 28 Oct 2020.

Description

The lektor static file content management system


tools\VERIFICATION.txt
VERIFICATION
Verification is intended to assist the Chocolatey moderators and community
in verifying that this package's contents are trustworthy.
 
Creating this package was a part of a contribution to the lektor github repository. The Lektor Team looks to have lektor installed via chocolatey as a package. The Lektor Team can validate the authenticity of this package.
tools\LICENSE.txt
From: https://www.getlektor.com/license/

LICENSE

Lektor License
Copyright (c) 2015 by the Armin Ronacher.

Some rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

The names of the contributors may not be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
tools\installer.py
#!/usr/bin/env python

from __future__ import print_function
import math
import os
import shutil
import sys
import tempfile
from subprocess import call

try:
    from shutil import which
except ImportError:
    from distutils.spawn import find_executable as which

try:
    from urllib.request import urlretrieve
except ImportError:
    from urllib import urlretrieve

IS_WIN = sys.platform == "win32"

if IS_WIN:
    try:
        import winreg
    except ImportError:
        import _winreg as winreg
    from ctypes import windll, wintypes


VIRTUALENV_URL = "https://bootstrap.pypa.io/virtualenv.pyz"

# this difference is for backwards-compatibility with the previous installer
APP_NAME = "lektor" if not IS_WIN else "lektor-cli"

# where to search for a writable bin directory on *nix.
# this order makes sure we try a system install first.
POSIX_BIN_DIRS = [
    "/usr/local/bin", "/opt/local/bin",
    "{home}/.bin", "{home}/.local/bin",
]

SILENT = (
    os.environ.get("LEKTOR_SILENT", "").lower()
    not in ("", "0", "off", "false")
)

if not os.isatty(sys.stdin.fileno()):
    # the script is being piped, we need to reset stdin
    sys.stdin = open("CON:" if IS_WIN else "/dev/tty")

if sys.version_info.major == 2:
    input = raw_input


def get_confirmation():
    if SILENT:
        return

    while True:
        user_input = 'y'

        if user_input in ("", "y"):
            print()
            return


def fail(message):
    print("Error: %s" % message, file=sys.stderr)
    sys.exit(1)


def multiprint(*lines, **kwargs):
    for line in lines:
        print(line, **kwargs)


def rm_recursive(*paths):
    def _error(path):
        multiprint(
            "Problem deleting {}".format(path),
            "Please try and delete {} manually".format(path),
            "Aborted!",
            file=sys.stderr,
        )
        sys.exit(1)

    def _rm(path):
        if os.path.isdir(path):
            shutil.rmtree(path)
        else:
            os.remove(path)

    for path in paths:
        if not os.path.lexists(path):
            continue
        try:
            _rm(path)
        except:
            _error(path)


class Progress(object):
    "A context manager to be used as a urlretrieve reporthook."

    def __init__(self):
        self.started = False

    def progress(self, count, bsize, total):
        size = count * bsize

        if size > total:
            progress = 100
        else:
            progress = math.floor(100 * size / total)

        out = sys.stdout
        if self.started:
            out.write("\b" * 4)

        out.write("{:3d}%".format(progress))
        out.flush()

        self.started = True

    def finish(self):
        sys.stdout.write("\n")

    def __enter__(self):
        return self.progress

    def __exit__(self, exc_type, exc_value, traceback):
        self.finish()


class FetchTemp(object):
    """
    Fetches the given URL into a temporary file.
    To be used as a context manager.
    """

    def __init__(self, url):
        self.url = url

        fname = os.path.basename(url)
        root, ext = os.path.splitext(fname)
        self.filename = tempfile.mktemp(prefix=root + "-", suffix=ext)

    def fetch(self):
        with self.Progress() as hook:
            urlretrieve(self.url, self.filename, reporthook=hook)

    def cleanup(self):
        os.remove(self.filename)

    def __enter__(self):
        self.fetch()

        return self.filename

    def __exit__(self, exc_type, exc_value, traceback):
        self.cleanup()


def create_virtualenv(target_dir):
    """
    Tries to create a virtualenv by using the built-in `venv` module,
    or using the `virtualenv` executable if present, or falling back
    to downloading the official zipapp.
    """

    def use_venv():
        try:
            import venv
        except ImportError:
            return

        # on Debian and Ubuntu systems Python is missing `ensurepip`,
        # prompting the user to install `python3-venv` instead.
        #
        # we could handle this, but we'll just let the command fail
        # and have the users install the package themselves.

        return call([sys.executable, "-m", "venv", target_dir])

    def use_virtualenv():
        venv_exec = which("virtualenv")
        if not venv_exec:
            return

        return call([venv_exec, "-p", sys.executable, target_dir])

    def use_zipapp():
        print("Downloading virtualenv: ", end="")
        with FetchTemp(VIRTUALENV_URL) as zipapp:
            return call([sys.executable, zipapp, target_dir])

    print("Installing virtual environment...")
    for func in use_venv, use_virtualenv, use_zipapp:
        retval = func()
        if retval is None:
            # command did not run
            continue
        if retval == 0:
            # command successful
            return
        # else...
        sys.exit(1)


def get_pip(lib_dir):
    return (
        os.path.join(lib_dir, "Scripts", "pip.exe") if IS_WIN
        else os.path.join(lib_dir, "bin", "pip")
    )


def install_lektor(lib_dir):
    create_virtualenv(lib_dir)

    pip = get_pip(lib_dir)

    args = [pip, "install"]
    if IS_WIN:
        # avoid fail due to PEP 517 on windows
        args.append("--prefer-binary")
    args.extend(["--upgrade", "Lektor"])

    return call(args)


def posix_find_bin_dir():
    home = os.environ["HOME"]
    preferred = [d.format(home=home) for d in POSIX_BIN_DIRS]

    # look for writable directories in the user's $PATH
    # (that are not sbin)
    dirs = [
        item
        for item in os.environ["PATH"].split(":")
        if not item.endswith("/sbin") and os.access(item, os.W_OK)
    ]

    if not dirs:
        fail(
            "None of the items in $PATH are writable. Run with "
            "sudo or add a $PATH item that you have access to."
        )

    # ... and prioritize them according to our preferences
    def _sorter(path):
        try:
            return preferred.index(path)
        except ValueError:
            return float("inf")

    dirs.sort(key=_sorter)
    return dirs[0]


def posix_find_lib_dir(bin_dir):
    # the chosen lib_dir depends on the bin_dir found:
    home = os.environ["HOME"]

    if bin_dir.startswith(home):
        # this is a local install
        return os.path.join(home, ".local", "lib", APP_NAME)

    # else, it's a system install
    parent = os.path.dirname(bin_dir)
    return os.path.join(parent, "lib", APP_NAME)


def windows_create_link(lib_dir, target_dir):
    exe = os.path.join(lib_dir, "Scripts", "lektor.exe")
    link = os.path.join(target_dir, "lektor.cmd")

    with open(link, "w") as link_file:
        link_file.write("@echo off\n")
        link_file.write('"{}" %*'.format(exe))


def windows_add_to_path(location):
    HWND_BROADCAST = 0xFFFF
    WM_SETTINGCHANGE = 0x1A

    key = winreg.OpenKey(
        winreg.HKEY_CURRENT_USER, "Environment", 0, winreg.KEY_ALL_ACCESS
    )

    try:
        value, _ = winreg.QueryValueEx(key, "Path")
    except WindowsError:
        value = ""

    paths = [path for path in value.split(";") if path != ""]

    if location not in paths:
        paths.append(location)
        value = ";".join(paths)
        winreg.SetValueEx(
            key, "Path", 0, winreg.REG_EXPAND_SZ, value
        )

        SendMessage = windll.user32.SendMessageW
        SendMessage.argtypes = (
            wintypes.HWND, wintypes.UINT, wintypes.WPARAM, wintypes.LPVOID
        )
        SendMessage.restype = wintypes.LPARAM
        SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0, "Environment")

        # also add the path to the environment,
        # so it's available in the current console
        os.environ['Path'] += ";%s" % location

    key.Close()


def posix_install():
    bin_dir = posix_find_bin_dir()
    lib_dir = posix_find_lib_dir(bin_dir)
    symlink_path = os.path.join(bin_dir, APP_NAME)

    multiprint(
        "Installing at:",
        "  bin: %s" % bin_dir,
        "  app: %s" % lib_dir,
        "",
    )

    if os.path.exists(lib_dir) or os.path.lexists(symlink_path):
        multiprint(
            "An existing installation was detected. This will be removed!",
            "",
        )

    get_confirmation()
    rm_recursive(lib_dir, symlink_path)
    install_lektor(lib_dir)

    os.symlink(os.path.join(lib_dir, "bin", "lektor"), symlink_path)


def windows_install():
    install_dir = os.path.join(os.environ["LocalAppData"], APP_NAME)
    lib_dir = os.path.join(install_dir, "lib")

    multiprint(
        "Installing at:",
        "  %s" % install_dir,
        "",
    )

    if os.path.exists(install_dir):
        multiprint(
            "An existing installation was detected. This will be removed!",
            "",
        )

    get_confirmation()
    rm_recursive(install_dir)
    install_lektor(lib_dir)

    windows_create_link(lib_dir, install_dir)
    windows_add_to_path(install_dir)


def install():
    multiprint(
        "",
        "Welcome to Lektor",
        "This script will install Lektor on your computer.",
        "",
    )

    if IS_WIN:
        windows_install()
    else:
        posix_install()

    multiprint(
        "",
        "All done!",
    )


if __name__ == "__main__":
    install()
tools\chocolateyuninstall.ps1
$app = Get-WmiObject -Class Win32_Product | Where-Object {
    $_.Name -match "lektor"
}

Remove-Item *
$app.Uninstall()
tools\chocolateyinstall.ps1
python tools/installer.py

Log in or click on link to see number of positives.

In cases where actual malware is found, the packages are subject to removal. Software sometimes has false positives. Moderators do not necessarily validate the safety of the underlying software, only that a package retrieves software from the official distribution point and/or validate embedded software against official distribution point (where distribution rights allow redistribution).

Chocolatey Pro provides runtime protection from possible malware.

Add to Builder Version Downloads Last Updated Status
lektor 1.0.0 143 Tuesday, October 13, 2020 Approved

Discussion for the lektor Package

Ground Rules:

  • This discussion is only about lektor and the lektor package. If you have feedback for Chocolatey, please contact the Google Group.
  • This discussion will carry over multiple versions. If you have a comment about a particular version, please note that in your comments.
  • The maintainers of this Chocolatey Package will be notified about new comments that are posted to this Disqus thread, however, it is NOT a guarantee that you will get a response. If you do not hear back from the maintainers after posting a message below, please follow up by using the link on the left side of this page or follow this link to contact maintainers. If you still hear nothing back, please follow the package triage process.
  • Tell us what you love about the package or lektor, or tell us what needs improvement.
  • Share your experiences with the package, or extra configuration or gotchas that you've found.
  • If you use a url, the comment will be flagged for moderation until you've been whitelisted. Disqus moderated comments are approved on a weekly schedule if not sooner. It could take between 1-5 days for your comment to show up.
comments powered by Disqus