GithubHelp home page GithubHelp logo

hplgit / preprocess Goto Github PK

View Code? Open in Web Editor NEW
23.0 23.0 14.0 312 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 87.98% C++ 10.21% TeX 0.07% Fortran 1.74%

preprocess's People

Contributors

hplgit avatar johannesring avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

preprocess's Issues

Incorrect recersive #include detection

1. Have the floowing files:
common.sh:
first.sh:
    # #include "common.sh"
second.sh:
    # #include "common.sh"
result.sh:
    # #include "first.sh"
    # #include "second.sh"

2. Try to preprocess the file result.sh:
preprocess: error: detected recursive #include of 'common.sh'





Original issue reported on code.google.com by [email protected] on 21 Aug 2014 at 5:39

tests/test_future/test_builtins.py fails with Python3.5

Hi,

this is a test error that comes out with Python3.5:

=================================== FAILURES ===================================
___________________________ BuiltinTest.test_compile ___________________________
self = <test_future.test_builtins.BuiltinTest testMethod=test_compile>
    def test_compile(self):
        compile('print(1)\n', '', 'exec')
        bom = b'\xef\xbb\xbf'
        compile(bom + b'print(1)\n', '', 'exec')
        compile(source='pass', filename='?', mode='exec')
        compile(dont_inherit=0, filename='tmp', source='0', mode='eval')
        compile('pass', '?', dont_inherit=1, mode='exec')
        # Fails on Py2.7:
        # Was: compile(memoryview(b"text"), "name", "exec")
        self.assertRaises(TypeError, compile)
        self.assertRaises(ValueError, compile, 'print(42)\n', '<string>', 'badmode')
        self.assertRaises(ValueError, compile, 'print(42)\n', '<string>', 'single', 0xff)
        # Raises TypeError in Python < v3.5, ValueError in v3.5:
        # self.assertRaises(TypeError, compile, chr(0), 'f', 'exec')
        self.assertRaises(TypeError, compile, 'pass', '?', 'exec',
                          mode='eval', source='0', filename='tmp')
        compile('print("\xe5")\n', '', 'exec')
>       self.assertRaises(TypeError, compile, chr(0), 'f', 'exec')
E       ValueError: source code string cannot contain null bytes
tests/test_future/test_builtins.py:532: ValueError
 1 failed, 975 passed, 51 skipped, 49 xfailed, 2 xpassed, 1 warnings in 40.77 seconds 

future build log on Fedora with Python2.7/Python3.5: https://kojipkgs.fedoraproject.org//work/tasks/471/11780471/build.log

Does future support Python3.5 ?

Installation fails under Python 3 on Mac

I'm trying to install on a Mac (running OS X 10.12.5) under Python 3. Installation under Python 2 succeds, but with Python 3 I get the following output:

» pip3 install --no-cache-dir --upgrade preprocess
Collecting preprocess
  Downloading preprocess-1.1.0.zip (59kB)
    100% |████████████████████████████████| 61kB 357kB/s
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/gm/8bn6zk2d3sd3wzk60tb08y180000gn/T/pip-build-uf_gm76_/preprocess/setup.py", line 28, in <module>
        import preprocess
      File "/private/var/folders/gm/8bn6zk2d3sd3wzk60tb08y180000gn/T/pip-build-uf_gm76_/preprocess/lib/preprocess.py", line 264
        except Exception, ex:
                        ^
    SyntaxError: invalid syntax

preprocess does not work out of the box on windows

I am unable to run "preprocess -h" in the dos-prompt on my windows 7 system and 
pythonxy v2.7.9 out of the box after installation.

I found that it has to do with the console script is not properly registered.


By changing the following in setup.py:

Replace 
    from distutils.core import setup
with
    from setuptools import setup

and
    scripts=[script],
with
    entry_points={
              'console_scripts': ['preprocess = preprocess:main']},

and redefining the beginning of the main function in preprocess to:

def main(argv=None):
    if argv is None:
        argv = sys.argv

it worked out of the box for me.



Original issue reported on code.google.com by [email protected] on 19 Jan 2015 at 2:01

Error: detected recursive #i[37 chars].py

Hi,

2 tests failed by compiling latest Preprocess-1.2.2 under Python3: http://fpaste.org/272764/

======================================================================
FAIL: preprocess_inputs/preprocessinputs/recursive_include_a.py
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./test_preprocess_inputs.py", line 103, in <lambda>
    testFunction = lambda self, fname=fname: _testOneInputFile(self, fname)
  File "./test_preprocess_inputs.py", line 88, in _testOneInputFile
    % pprint.pformat(diff))
AssertionError: "preprocess: error: detected recursive #i[37 chars].py'" != 'Fatal Python error: Cannot recover from [13285 chars] ...'
Diff is 13314 characters long. Set self.maxDiff to None to see it. : <expected error> != <actual error>:
['- preprocess: error: detected recursive #include of '
 "'inputs/recursive_include_a.py'",
 '+ Fatal Python error: Cannot recover from stack overflow.\n',
 '+ \n',
 '+ Current thread 0x00007fe492e19700 (most recent call first):\n',
 '+   File '
 '"/home/sagitter/rpmbuild/BUILD/python3-preprocess-1.2.2-1.20150919gitd5ab9a.fc22/lib/preprocess.py", '
 'line 801 in getContentType\n',
...

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.