Code Monkey home page Code Monkey logo

hoep's Issues

Installing on Windows with 2.7

Hi, I get the following error installing on Windows. I poked around stackoverflow for possible explanatations and found these two links:

http://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix

http://stackoverflow.com/questions/6985109/how-to-compile-c-code-from-cython-with-gcc

Compiling c is all a bit beyond my understanding, any ideas on how to solve this?

Thanks.

Console print out...
.................................

creating build\lib.win32-2.7

C:\MinGW\bin\gcc.exe -mno-cygwin -shared -s build\temp.win32-2.7\Release\ext\py2k\hoep.o build\temp.win32-2.7\Release\ext\py2k\wrapper.o build\temp.win32-2.7\Release\ext\hoedown\autolink.o build\temp.win32-2.7\Release\ext\hoedown\buffer.o build\temp.win32-2.7\Release\ext\hoedown\document.o build\temp.win32-2.7\Release\ext\hoedown\escape.o build\temp.win32-2.7\Release\ext\hoedown\html.o build\temp.win32-2.7\Release\ext\hoedown\html_blocks.o build\temp.win32-2.7\Release\ext\hoedown\html_smartypants.o build\temp.win32-2.7\Release\ext\hoedown\stack.o build\temp.win32-2.7\Release\ext\hoedown\version.o build\temp.win32-2.7\Release\ext\py2k\hoep.def -LC:\Python27\libs -LC:\Python27\PCbuild -lpython27 -lmsvcr90 -o build\lib.win32-2.7\hoep.pyd

build\temp.win32-2.7\Release\ext\py2k\hoep.o:hoep.c:(.text+0x420): undefined reference to `_imp__PyExc_TypeError'

build\temp.win32-2.7\Release\ext\py2k\wrapper.o:wrapper.c:(.text+0x9c): undefined reference to `_imp__PyExc_TypeError'

build\temp.win32-2.7\Release\ext\py2k\wrapper.o:wrapper.c:(.text+0x203): undefined reference to `_imp___Py_NoneStruct'

build\temp.win32-2.7\Release\ext\py2k\wrapper.o:wrapper.c:(.text+0x6f0): undefined reference to `_imp___Py_TrueStruct'

build\temp.win32-2.7\Release\ext\py2k\wrapper.o:wrapper.c:(.text+0x6f8): undefined reference to `_imp___Py_ZeroStruct'

build\temp.win32-2.7\Release\ext\py2k\wrapper.o:wrapper.c:(.text+0x93f): undefined reference to `_imp___Py_TrueStruct'

build\temp.win32-2.7\Release\ext\py2k\wrapper.o:wrapper.c:(.text+0x947): undefined reference to `_imp___Py_ZeroStruct'

build\temp.win32-2.7\Release\ext\py2k\wrapper.o:wrapper.c:(.text+0x9b2): undefined reference to `_imp___Py_TrueStruct'

build\temp.win32-2.7\Release\ext\py2k\wrapper.o:wrapper.c:(.text+0x9ba): undefined reference to `_imp___Py_ZeroStruct'

collect2: ld returned 1 exit status

error: command 'gcc' failed with exit status 1


Cleaning up...

Removing temporary dir c:\users\andrew\appdata\local\temp\pip_build_Andrew...
Command C:\Python27\python2.7.exe -c "import setuptools;file='c:\users\andrew\appdata\local\temp\pip_build_Andrew\hoep\setup.py';exec(compile(open(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record c:\users\andrew\appdata\local\temp\pip-vahqak-record\install-record.txt --single-version-externally-managed failed with error code 1 in c:\users\andrew\appdata\local\temp\pip_build_Andrew\hoep

Exception information:
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\pip\basecommand.py", line 134, in main
status = self.run(options, args)
File "C:\Python27\lib\site-packages\pip\commands\install.py", line 241, in run
requirement_set.install(install_options, global_options, root=options.root_path)
File "C:\Python27\lib\site-packages\pip\req.py", line 1298, in install
requirement.install(install_options, global_options, _args, *_kwargs)
File "C:\Python27\lib\site-packages\pip\req.py", line 625, in install
cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
File "C:\Python27\lib\site-packages\pip\util.py", line 670, in call_subprocess
% (command_desc, proc.returncode, cwd))
InstallationError: Command C:\Python27\python2.7.exe -c "import setuptools;file='c:\users\andrew\appdata\local\temp\pip_build_Andrew\hoep\setup.py';exec(compile(open(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record c:\users\andrew\appdata\local\temp\pip-vahqak-record\install-record.txt --single-version-externally-managed failed with error code 1 in c:\users\andrew\appdata\local\temp\pip_build_Andrew\hoep

"pip install hoep" fails on Arch Linux

Hi, I'm on Arch Linux with python 3.4.0, and pip install hoep results in the following compilation errors:

Downloading/unpacking hoep
  Running setup.py (path:/tmp/pip_build_nh/hoep/setup.py) egg_info for package hoep

    warning: no previously-included files matching '*.pyc' found anywhere in distribution
Installing collected packages: hoep
  Running setup.py install for hoep
    building 'hoep' extension
    gcc -pthread -Wno-unused-result -Werror=declaration-after-statement -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -fPIC -I/usr/include/python3.4m -c ext/py3k/hoep.c -o build/temp.linux-x86_64-3.4/ext/py3k/hoep.o
    ext/py3k/hoep.c: In function ‘render’:
    ext/py3k/hoep.c:35:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
         hoedown_renderer *renderer = hoedown_html_renderer_new(render_flags, 0);
         ^
    ext/py3k/hoep.c:48:9: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
             Py_ssize_t sp_size;
             ^
    ext/py3k/hoep.c: In function ‘Hoep_init’:
    ext/py3k/hoep.c:79:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
         hoedown_html_renderer_state *state = self->renderer->opaque;
         ^
    ext/py3k/hoep.c:82:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
         void **hd_callbacks = (void **) self->renderer;
         ^
    ext/py3k/hoep.c: In function ‘Hoep_render’:
    ext/py3k/hoep.c:115:9: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
             Py_ssize_t md_size;
             ^
    ext/py3k/hoep.c:129:9: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
             Py_ssize_t sp_size;
             ^
    ext/py3k/hoep.c:152:9: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
             PyObject *message = PyUnicode_FromFormat("must return str, %s received", Py_TYPE(html)->tp_name);
             ^
    cc1: some warnings being treated as errors
    error: command 'gcc' failed with exit status 1
    Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_nh/hoep/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-p0e8uzn1-record/install-record.txt --single-version-externally-managed --compile:
    running install

running build

running build_ext

building 'hoep' extension

creating build

creating build/temp.linux-x86_64-3.4

creating build/temp.linux-x86_64-3.4/ext

creating build/temp.linux-x86_64-3.4/ext/py3k

creating build/temp.linux-x86_64-3.4/ext/hoedown

gcc -pthread -Wno-unused-result -Werror=declaration-after-statement -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -fPIC -I/usr/include/python3.4m -c ext/py3k/hoep.c -o build/temp.linux-x86_64-3.4/ext/py3k/hoep.o

ext/py3k/hoep.c: In function ‘render’:

ext/py3k/hoep.c:35:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]

     hoedown_renderer *renderer = hoedown_html_renderer_new(render_flags, 0);

     ^

ext/py3k/hoep.c:48:9: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]

         Py_ssize_t sp_size;

         ^

ext/py3k/hoep.c: In function ‘Hoep_init’:

ext/py3k/hoep.c:79:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]

     hoedown_html_renderer_state *state = self->renderer->opaque;

     ^

ext/py3k/hoep.c:82:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]

     void **hd_callbacks = (void **) self->renderer;

     ^

ext/py3k/hoep.c: In function ‘Hoep_render’:

ext/py3k/hoep.c:115:9: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]

         Py_ssize_t md_size;

         ^

ext/py3k/hoep.c:129:9: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]

         Py_ssize_t sp_size;

         ^

ext/py3k/hoep.c:152:9: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]

         PyObject *message = PyUnicode_FromFormat("must return str, %s received", Py_TYPE(html)->tp_name);

         ^

cc1: some warnings being treated as errors

error: command 'gcc' failed with exit status 1

----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_nh/hoep/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-p0e8uzn1-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_nh/hoep
Storing debug log for failure in /home/nh/.pip/pip.log

GCC version:

: gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /build/gcc/src/gcc-4.8-20140206/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-cloog-backend=isl --disable-cloog-version-check --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --disable-multilib --disable-werror --enable-checking=release
Thread model: posix
gcc version 4.8.2 20140206 (prerelease) (GCC) 

Allow using original behavior when subclassing `Hoep`

Greetings. First I want to thank you for this great package.

I've found one thing that has no easy workaround. Say I'm writing a custom renderer:

class MyRenderer(h.Hoep):
    def header(self, text, level):
         if text.count('foo'):
                return ''
         else:
                return # I need this to fall back to the original behavior.
                       # (ie as if there's no header callback at all)

I've looked over the docs and seems there's no mentioning about this feature. I think one option is to let returning None trigger original behavior should be quite reasonable.

Thanks in advance.

SIGSEGV if `block_code` is overriden but no language is specified in the document.

The title pretty much says it all; this simple test case:

import hoep as h
from xml.sax.saxutils import escape

class MyHoep (h.Hoep):
    def block_code(self, code, lang):
        return '<pre>' + escape(code) + '</pre>'

p = MyHoep(h.EXT_FENCED_CODE, h.HTML_SMARTYPANTS)
p.render('''```
test
```''')

triggers a segmentation fault (as of commit 8def993). Same thing happens when using indented code blocks instead of fenced ones; either removing the block_code method or specifying a language "fixes" the problem.

(I'm using CPython 3.4, if that's important.)

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.