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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file scons-tool-kpsewhich-0.2.0.tar.gz.

File metadata

  • Download URL: scons-tool-kpsewhich-0.2.0.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for scons-tool-kpsewhich-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3c818d002816b2ba95fe7863f6995c0dc12047ef9b0928e7397e0b375105b892
MD5 5cfc354590e1885dd125537024d0b6c1
BLAKE2b-256 f952ff3f0e7bc7e0a04ce95091bfe19f564b099f8010fba1a058e62f05948478

See more details on using hashes here.

File details

Details for the file scons_tool_kpsewhich-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: scons_tool_kpsewhich-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for scons_tool_kpsewhich-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 49a99057b81c846275a15affcae3619a0e4a1db4d7b038119d7c19584c11ccbe
MD5 d228db45d523b8c19aad7bcb4dffd199
BLAKE2b-256 44d8ef2ee0fce396d7a28f1801e6d01762dcf2e72e1b94663cd8f6c5b0b06b05

See more details on using hashes here.

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