Code Monkey home page Code Monkey logo

scons-tool-kpsewhich's Introduction

scons-tool-kpsewhich

PyPi package version

Travis CI build status

image

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

scons-tool-kpsewhich's People

Contributors

dependabot[bot] avatar ptomulik avatar

Watchers

 avatar  avatar

scons-tool-kpsewhich's Issues

KPSFindFiles(..., path='...') result is inconsistent across platforms

This looks like search order issue. Consider this example:

ptomulik@tea:$ find ./share/
./share/
./share/texmf
./share/texmf/tex
./share/texmf/tex/amstex
./share/texmf/tex/amstex/local
./share/texmf/tex/amstex/local/foo.cls
./share/texmf/tex/amstex/local/bar.sty
./share/texmf/tex/latex
./share/texmf/tex/latex/local
./share/texmf/tex/latex/local/foo.cls
./share/texmf/tex/latex/local/bar.sty

and this SConstruct

import os
env = Environment(ENV = os.environ, tools = ['kpsewhich'])
result = env.KPSFindFiles(['foo.cls', 'bar.sty'],  path='./share/texmf/tex///', progname='latex')

on my Debians (one PC with apt-install texlive, and one virtualbox with texlive installed with bin/install-tex.py script) it returns

./share/texmf/tex/latex/local/foo.cls
./share/texmf/tex/latex/local/bar.sty

however, on travis and appveyor it returns

./share/texmf/tex/amstex/local/foo.cls
./share/texmf/tex/amstex/local/bar.sty

It should be fixed or at least explained somehow.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.