facebook / pyre2 Goto Github PK
View Code? Open in Web Editor NEWPython wrapper for RE2
License: BSD 3-Clause "New" or "Revised" License
Python wrapper for RE2
License: BSD 3-Clause "New" or "Revised" License
@localhost pyre2 % make CFLAGS='-fPIC -c -Wall -Wno-sign-compare -O3 -g -I.'
python3 setup.py build
running build
running build_py
running build_ext
building '_re2' extension
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -fPIC -c -Wall -Wno-sign-compare -O3 -g -I. -I/usr/local/include -I/usr/local/opt/[email protected]/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/[email protected]/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8 -c _re2.cc -o build/temp.macosx-10.15-x86_64-3.8/_re2.o -std=c++11
_re2.cc:211:3: warning: suggest braces around initialization of subobject [-Wmissing-braces]
PyObject_HEAD_INIT(NULL)
^~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/[email protected]/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/object.h:85:5: note: expanded from macro 'PyObject_HEAD_INIT'
1, type },
^~~~~~~
_re2.cc:255:3: warning: suggest braces around initialization of subobject [-Wmissing-braces]
PyObject_HEAD_INIT(NULL)
^~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/[email protected]/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/object.h:85:5: note: expanded from macro 'PyObject_HEAD_INIT'
1, type },
^~~~~~~
_re2.cc:299:3: warning: suggest braces around initialization of subobject [-Wmissing-braces]
PyObject_HEAD_INIT(NULL)
^~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/[email protected]/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/object.h:85:5: note: expanded from macro 'PyObject_HEAD_INIT'
1, type },
^~~~~~~
3 warnings generated.
clang++ -bundle -undefined dynamic_lookup -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -fPIC -c -Wall -Wno-sign-compare -O3 -g -I. build/temp.macosx-10.15-x86_64-3.8/_re2.o -L/usr/local/lib -L/usr/local/opt/[email protected]/lib -L/usr/local/opt/sqlite/lib -lre2 -o build/lib.macosx-10.15-x86_64-3.8/_re2.cpython-38-darwin.so
clang: warning: build/temp.macosx-10.15-x86_64-3.8/_re2.o: 'linker' input unused [-Wunused-command-line-argument]
clang: warning: -lre2: 'linker' input unused [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-bundle' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-undefined dynamic_lookup' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-fPIC' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-O3' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-g' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-I .' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-L/usr/local/lib' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-L/usr/local/opt/[email protected]/lib' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-L/usr/local/opt/sqlite/lib' [-Wunused-command-line-argument]
python3 setup.py build_ext -i
running build_ext
building '_re2' extension
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -fPIC -c -Wall -Wno-sign-compare -O3 -g -I. -I/usr/local/include -I/usr/local/opt/[email protected]/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/[email protected]/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8 -c _re2.cc -o build/temp.macosx-10.15-x86_64-3.8/_re2.o -std=c++11
_re2.cc:211:3: warning: suggest braces around initialization of subobject [-Wmissing-braces]
PyObject_HEAD_INIT(NULL)
^~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/[email protected]/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/object.h:85:5: note: expanded from macro 'PyObject_HEAD_INIT'
1, type },
^~~~~~~
_re2.cc:255:3: warning: suggest braces around initialization of subobject [-Wmissing-braces]
PyObject_HEAD_INIT(NULL)
^~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/[email protected]/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/object.h:85:5: note: expanded from macro 'PyObject_HEAD_INIT'
1, type },
^~~~~~~
_re2.cc:299:3: warning: suggest braces around initialization of subobject [-Wmissing-braces]
PyObject_HEAD_INIT(NULL)
^~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/[email protected]/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/object.h:85:5: note: expanded from macro 'PyObject_HEAD_INIT'
1, type },
^~~~~~~
3 warnings generated.
clang++ -bundle -undefined dynamic_lookup -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -fPIC -c -Wall -Wno-sign-compare -O3 -g -I. build/temp.macosx-10.15-x86_64-3.8/_re2.o -L/usr/local/lib -L/usr/local/opt/[email protected]/lib -L/usr/local/opt/sqlite/lib -lre2 -o build/lib.macosx-10.15-x86_64-3.8/_re2.cpython-38-darwin.so
clang: warning: build/temp.macosx-10.15-x86_64-3.8/_re2.o: 'linker' input unused [-Wunused-command-line-argument]
clang: warning: -lre2: 'linker' input unused [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-bundle' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-undefined dynamic_lookup' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-fPIC' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-O3' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-g' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-I .' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-L/usr/local/lib' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-L/usr/local/opt/[email protected]/lib' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-L/usr/local/opt/sqlite/lib' [-Wunused-command-line-argument]
error: can't copy 'build/lib.macosx-10.15-x86_64-3.8/_re2.cpython-38-darwin.so': doesn't exist or not a regular file
make: *** [build] Error 1
@localhost pyre2 %
When the β (RIGHT SINGLE QUOTATION MARK ; HTML ’ HEX 0x2019 ) is in the string to search the span is displace by 2, for example:
string = "itβs your car"
regex = re2.compile('you')
match = regex.search(string)
pather_match = string[match.start():match.end()]
print(pather_match)
'ur c'
As you known, regexp and match object always create some dynamic members with attr_dict, which can't be display in the dir() function result, we should add a static member dict point to the dict
Please refer to the commit, thanks
While I suspect there is some specific local environment issue that produces this awful result, I think that we need to prevent it from building/installing a broken package.
pip install fb-re2
python -c "import re2; re2.compile('foo')"
[1] 99748 segmentation fault python -c "import re2; re2.compile('foo')"
I was able to reproduce the error with both python3.6 and pyton3.7 installed using pyenv.
After June 2022, ABSL no longer supports c++11, so it cannot build anymore.
See PR #17 that should fix this issue. No license included is an issue for distribution packaging.
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.