Skip to main content

KpseWhich tool for SCons

Project description

PyPi package version Travis CI build status https://ci.appveyor.com/api/projects/status/github/ptomulik/scons-tool-kpsewhich?svg=true

This tool provides SCons with interface to kpsewhich utility. The kpsewhich program is a part of kpathsea library, which in turn is a part of TeX Live distribution. Its purpose is to search within the TeX directory structure (TDS) for files such as TeX classes, styles, BibTeX databases, fonts etc. For more informations see kpathsea manual and informations about TeX directory structure (TDS).

This tool appends new methods to the SCons Environment. It does not provide any builders, but rather equips SCons Environment with methods that call kpsewhich program during the SConscript-reading phase. This tool does not produce any files, it is thought as an extension for obtaining textual information from external program.

INSTALLATION

There are few ways to install this tool for your project.

From pypi

This method may be preferable if you build your project under a virtualenv. To add kpsewhich tool from pypi, type (within your wirtualenv):

pip install scons-tool-loader scons-tool-kpsewhich

or, if your project uses pipenv:

pipenv install --dev scons-tool-loader scons-tool-kpsewhich

Alternatively, you may add this to your Pipfile

[dev-packages]
scons-tool-loader = "*"
scons-tool-kpsewhich = "*"

The tool will be installed as a namespaced package sconstool.kpsewhich in project’s virtual environment. You may further use scons-tool-loader to load the tool.

As a git submodule

  1. Create new git repository:

    mkdir /tmp/prj && cd /tmp/prj
    touch README.rst
    git init
  2. Add the scons-tool-kpsewhich as a submodule:

    git submodule add git://github.com/ptomulik/scons-tool-kpsewhich.git site_scons/site_tools/kpsewhich
  3. For python 2.x create __init__.py in site_tools directory:

    touch site_scons/site_tools/__init__.py

    this will allow to directly import site_tools.kpsewhich (this may be required by other tools).

USAGE EXAMPLES

Find files article.cls and amsmath.sty used by latex:

env = Environment(tools = ['tex', 'kpsewhich'])
files = env.KPSFindFiles(['article.cls','amsmath.sty'], progname='$LATEX')

Find all occurrences of unicode.sty file in TDS:

env = Environment(tools = ['kpsewhich'])
files = env.KPSFindAllFiles('unicode.sty')

Other functions (correspond directly to kpsewhich function options):

texmf = env.KPSExpandBraces('a{b,c}d')# kpsewhich -expand-braces 'a{b,c}d'
texmf = env.KPSExpandPath('$TEXMF')   # kpsewhich -expand-path '$TEXMF'
texmf = env.KPSExpandVar('$TEXMF')    # kpsewhich -expand-var '$TEXMF'
texpath = env.KPSShowPath('tex')      # kpsewhich -show-path 'tex'
home = env.KPSVarValue('TEXMFHOME')   # kpsewhich -var-value 'TEXMFHOME'

CONSTRUCTION VARIABLES

The following construction variables may be used to configure the kpsewhich tool. They may be also provided as keyword arguments to KPSXxx() methods.

Variable

Description

KPSEWHICH

the kpsewhich executable

KPSEWHICHFLAGS

additional flags to kpsewhich

KPSVARIABLES

(re)define variables for kpsewhich

KPSVARIABLES must be a dictionary in form { NAME : VALUE }, for example:

KPSVARIABLES = {"TEXMFHOME" : "/home/ptomulik/texmf"}

ARGUMENTS

These arguments are accepted by some KPSXxx() methods. All the methods accept progname. All other arguments are accepted by KPSFindFiles and KPSFindAllFiles.

Variable

Description

dpi

corresponds to -dpi flag,

format

corresponds to -format flag,

path

corresponds to -path flag

progname

corresponds to -progname flag

subdir

corresponds to -subdir flag

LICENSE

Copyright (c) 2013-2020 by Paweł Tomulik

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scons-tool-kpsewhich-0.2.0.tar.gz (7.9 kB view hashes)

Uploaded Source

Built Distribution

scons_tool_kpsewhich-0.2.0-py3-none-any.whl (7.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page