Giter Site home page Giter Site logo

doconce / preprocess Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hplgit/preprocess

10.0 3.0 2.0 124 KB

C/C++ preprocessor-like tool for a range of languages (i.e., #ifdef, #ifndef, #if-else, #include, etc. for Python, LaTeX, Bash, JavaScript, "whatever").

License: MIT License

Python 88.00% C++ 10.19% TeX 0.07% Fortran 1.74%

preprocess's Issues

Do you still need to support for Python 2

This project depends on future to provide some pieces of Python 2 support. The problem is that future is broken with Python 3.12 and will stop working completely with Python 3.13. Therefore it'd be good to remove the dependency and either drop Python 2 support as well or find another way to provide it. It should not be hard and I can help with that.

Regression with #include and -I option

After having some spare time to resurrect a personal project of mine which uses preprocess, I upgraded from v1.1.0 to v1.2.3.

Found a regression with #include statements and providing include paths with the -I command-line option, whereby preprocess is no longer able to find the #include'd file in any of the include paths provided. Preprocess errors out with a message similar to the following:

preprocess: error: could not find #include'd file "c.p.txt" on include path: ['include']

Steps to reproduce:

  1. Create a.p.txt to have the following content:
BEFORE include
# #include "b.p.txt"
AFTER include
  1. Create includes/b.p.txt to have the following content:
DURING include
  1. Run preprocess from in the same directory as a.p.txt: preprocess -I includes a.p.txt
  2. Observed output:
BEFORE include
preprocess: error: could not find #include'd file "b.p.txt" on include path: ['includes']
  1. Expected output:
BEFORE include
DURING include
AFTER include

I believe the regression appeared in commit e937b3b where the else: raise statements were indented from the matching for statement to the matching if statement:

for d in [os.path.dirname(infile)] + includePath:
fname = os.path.normpath(os.path.join(d, f))
if os.path.exists(fname):
break
else:
raise PreprocessError("could not find #include'd file "\
"\"%s\" on include path: %r"\
% (f, includePath))

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.