[Mesa-dev] [PATCH 06/18] mapi/new: use the static_data offsets in the new generator

Emil Velikov emil.l.velikov at gmail.com
Fri Nov 23 13:35:31 UTC 2018


On 2018/11/21, Dylan Baker wrote:
> Quoting Emil Velikov (2018-11-21 04:04:03)

> >  
> > +import os
> > +GLAPI = os.path.join(os.path.dirname(sys.argv[0]), "..", "glapi/gen")
> 
> you should use __file__ instead of sys.argv[0], also don't hardcode '/' into
> there, join 'glapi' and 'gen' for windows
> 
> > +sys.path.append(GLAPI)
> 
> also, use sys.path.insert(0, GLAPI), as python looks through paths in order, and
> insert is always faster.
> 
Fwiw the code above is copy/paste from src/mapi/mapi_abi.py. With a
similar hunk in src/mesa/main/get_hash_generator.py

Not sure how it works on Windows ... will address those files with a
small prep series and update this hunk.


> > +
> > +        if slot_set == False and name[-3:] != "ARB":
> 
> use 'is' with singletons like True, False, and None instead '=='. You might also
> consider using .startswith() and .endswith(), as they're clearer than random
> subslice.
> 
Sub slices are so much shorter hence why I opted for it. But will
rework with v2.

Thanks
Emil


More information about the mesa-dev mailing list