hplgit / preprocess Goto Github PK
View Code? Open in Web Editor NEWC/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
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
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
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 ?
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
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
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',
...
Please add a tag for the current version.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.