[GRASS-dev] grass7 on mac OSX

Massimo Di Stefano massimodisasha at gmail.com
Fri Jun 4 15:28:38 EDT 2010


Started compilation: Ven  4 Giu 2010 21:08:54 CEST
--
Errors in:
/Users/Shared/source/grass_trunk/lib/python/default
/Users/Shared/source/grass_trunk/gui/wxpython
/Users/Shared/source/grass_trunk/visualization/nviz
--
In case of errors please change into the directory with error and run 'make'.
If you get multiple errors, you need to deal with them in the order they
appear in the error log. If you get an error building a library, you will
also get errors from anything which uses the library.
--
Finished compilation: Ven  4 Giu 2010 21:18:34 CEST
make: *** [default] Error 1
host-001:grass_trunk sasha$ cd /Users/Shared/source/grass_trunk/lib/python/default
-bash: cd: /Users/Shared/source/grass_trunk/lib/python/default: No such file or directory
host-001:grass_trunk sasha$



cd /Users/Shared/source/grass_trunk/lib/python
make


...
....
make[2]: `date.py' is up to date.
make[2]: `grass.py' is up to date.
make[2]: `raster.py' is up to date.
make[2]: `gmath.py' is up to date.
make[2]: `proj.py' is up to date.
make[2]: `imagery.py' is up to date.
make[2]: `vector.py' is up to date.
make[2]: `display.py' is up to date.
make[2]: `stats.py' is up to date.
make[2]: `dbmi.py' is up to date.
make[2]: `g3d.py' is up to date.
make[2]: `arraystats.py' is up to date.
make[2]: `cluster.py' is up to date.
make[2]: `trans.py' is up to date.
make[2]: `vedit.py' is up to date.
make[2]: `ogsf.py' is up to date.
GISRC=/Users/Shared/source/grass_trunk/dist.i386-apple-darwin10.3.0/demolocation/.grassrc70 GISBASE=/Users/Shared/source/grass_trunk/dist.i386-apple-darwin10.3.0 PATH="/Users/Shared/source/grass_trunk/dist.i386-apple-darwin10.3.0/bin:$PATH" PYTHONPATH="/Users/Shared/source/grass_trunk/dist.i386-apple-darwin10.3.0/etc/python:$PYTHONPATH" DYLD_LIBRARY_PATH="/Users/Shared/source/grass_trunk/dist.i386-apple-darwin10.3.0/bin:/Users/Shared/source/grass_trunk/dist.i386-apple-darwin10.3.0/lib:/Users/Shared/source/grass_trunk/dist.i386-apple-darwin10.3.0/lib:/Users/Shared/source/tables-2.1.2/tables/" LC_ALL=C ./ctypesgen.py -I/Users/Shared/source/grass_trunk/dist.i386-apple-darwin10.3.0/include -I/Users/Shared/source/grass_trunk/dist.i386-apple-darwin10.3.0/include -lgrass_nviz   /Users/Shared/source/grass_trunk/dist.i386-apple-darwin10.3.0/include/grass/nviz.h -o nviz.py
Status: Preprocessing /var/folders/G7/G7KYb9O2GaGW2zFTZZP9nE+++TI/-Tmp-/tmps7WNie.h
Status: gcc -E -U __BLOCKS__ -dD -I/Users/Shared/source/grass_trunk/dist.i386-apple-darwin10.3.0/include -I/Users/Shared/source/grass_trunk/dist.i386-apple-darwin10.3.0/include "-Dinline=" "-D__inline__=" "-D__extension__=" "-D_Bool=uint8_t" "-D__const=const" "-D__asm__(x)=" "-D__asm(x)=" "-DCTYPESGEN=1" "-D__uint16_t=uint16_t" "-D__uint32_t=uint32_t" "-D__uint64_t=uint64_t" /var/folders/G7/G7KYb9O2GaGW2zFTZZP9nE+++TI/-Tmp-/tmps7WNie.h
Traceback (most recent call last):
  File "./ctypesgen.py", line 134, in <module>
    descriptions=ctypesgencore.parser.parse(options.headers,options)
  File "/Users/Shared/source/grass_trunk/lib/python/ctypes/ctypesgencore/parser/__init__.py", line 21, in parse
    parser.parse()
  File "/Users/Shared/source/grass_trunk/lib/python/ctypes/ctypesgencore/parser/datacollectingparser.py", line 67, in parse
    ctypesparser.CtypesParser.parse(self,f.name,None)
  File "/Users/Shared/source/grass_trunk/lib/python/ctypes/ctypesgencore/parser/cparser.py", line 113, in parse
    self.preprocessor_parser.parse(filename)
  File "/Users/Shared/source/grass_trunk/lib/python/ctypes/ctypesgencore/parser/preprocessor.py", line 197, in parse
    token = self.lexer.token()
  File "/Users/Shared/source/grass_trunk/lib/python/ctypes/ctypesgencore/parser/preprocessor.py", line 51, in token
    result = lex.Lexer.token(self)
  File "/Users/Shared/source/grass_trunk/lib/python/ctypes/ctypesgencore/parser/lex.py", line 297, in token
    newtok = func(tok)
  File "/Users/Shared/source/grass_trunk/lib/python/ctypes/ctypesgencore/parser/pplexer.py", line 237, in t_ANY_string_literal
    t.value = StringLiteral(t.value)
  File "/Users/Shared/source/grass_trunk/lib/python/ctypes/ctypesgencore/parser/pplexer.py", line 63, in __new__
    raise ValueError("invalid \\x escape in %s" % value)
ValueError: invalid \x escape in ".HFS+ Private Directory Data\xd"
make[2]: *** [nviz.py] Error 1
make[1]: *** [default] Error 2
host-001:python sasha$ 



i tried to change in grass_trunk/lib/python/ctypes/ctypesgencore/parser/pplexer.py  to :

class StringLiteral(str):
    def __new__(cls, value):
        assert value[0] == '"' and value[-1] == '"'
        # Unescaping probably not perfect but close enough.
        try:
            value = value[1:-1].decode('string_escape')
        except ValueError, e:
            value = re.sub(r'\\x([0-9a-fA-F])(?![0-9a-fA-F])', r'\x0\1', value[1:-1]).decode('string_escape')
        return str.__new__(cls, value)


but print out a lot of syntax errors, 
maybe i changed it wrong,
if usefull i can try to rebuild and attach the log.




Il giorno 04/giu/2010, alle ore 20.04, Glynn Clements ha scritto:

> Can you try the latest version? It will still fail, but it should
> provide more information (specifically, the "invalid \x escape"
> exception should now report the string that it's trying to decode).
> 
> ctypesgen ignores errors from the preprocessor, but errors within
> ctypesgen itself (e.g. the decoding error) tend to be fatal.
> 
> FWIW, the code acknowledges that the decoding may not be quite right
> (it decodes string literals according to Python's syntax, which is
> modelled on C but may have subtle differences):
> 
>        # Unescaping probably not perfect but close enough.
>        value = value[1:-1].decode('string_escape')
> 
> The Python language reference says of \x escapes:
> 
> 	Unlike in Standard C, exactly two hex digits are required
> 
> Assuming that's the issue, it should suffice to replace the above
> with:
> 
> 	try:
> 	    value = value[1:-1].decode('string_escape')
> 	except ValueError, e:
> 	    value = re.sub(r'\\x([0-9a-fA-F])(?![0-9a-fA-F])',
> 	                   r'\x0\1',
> 	                   value[1:-1]).decode('string_escape')



More information about the grass-dev mailing list