Use xml.etree for xml parsing for greater portability.
Change-Id: Ic9b3b487e9b363a89d134d048db9fa79fbd66f6f
- Ensure the pip module is installed (it should be by default)
- Need python3.3 or later to get the Windows py.exe launcher that is used to get python3 rather than python2 if both are installed on Windows
- 32 bit python works
-- Python lxml package must be installed
- - Download the lxml package from
- http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml
- 32-bit latest for Python 3.5 is: lxml-3.5.0-cp35-none-win32.whl
- 64-bit latest for Python 3.5 is: lxml-3.5.0-cp35-none-win_amd64.whl
- - The package can be installed with pip as follows:
- pip install lxml-3.5.0-cp35-none-win32.whl
- If pip is not in your path, you can find it at $PYTHON_HOME\Scripts\pip.exe, where PYTHON_HOME is the folder where you installed Python.
- Git (from http://git-scm.com/download/win).
- Note: If you use Cygwin, you can normally use Cygwin's "git.exe". However, in order to use the "update_external_sources.bat" script, you must have this version.
- Tell the installer to allow it to be used for "Developer Prompt" as well as "Git Bash".
brew install cmake
brew install python
brew install python3
-pip install --upgrade pip
-pip install lxml
-pip3.5 install --upgrade pip
-pip3.5 install lxml
```
### Build steps for Android
Use the following to ensure the Android build works.
import os,re,sys
from collections import namedtuple
-from lxml import etree
+import xml.etree.ElementTree as etree
def write( *args, **kwargs ):
file = kwargs.pop('file',sys.stdout)
file.write( end )
# noneStr - returns string argument, or "" if argument is None.
-# Used in converting lxml Elements into text.
+# Used in converting etree Elements into text.
# str - string to convert
def noneStr(str):
if (str):
# For typedefs, add (APIENTRY *<name>) around the name and
# use the PFN_cmdnameproc naming convention.
# Done by walking the tree for <proto> element by element.
- # lxml.etree has elem.text followed by (elem[i], elem[i].tail)
+ # etree has elem.text followed by (elem[i], elem[i].tail)
# for each child element and any following text
# Leading text
pdecl += noneStr(proto.text)
#if value not in self.stypes:
# print('WARNING: {} is not part of the VkStructureType enumeration [{}]'.format(value, typeName))
else:
- value = '<ERROR>'
+ value = typeName
+ # Remove EXT
+ value = re.sub('EXT', '', value)
+ # Add underscore between lowercase then uppercase
+ value = re.sub('([a-z0-9])([A-Z])', r'\1_\2', value)
+ # Change to uppercase
+ value = value.upper()
+ # Add STRUCTURE_TYPE_
+ value = re.sub('VK_', 'VK_STRUCTURE_TYPE_', value)
# Store the required type value
self.structTypes[typeName] = self.StructType(name=name, value=value)
#
# MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
import io,os,re,string,sys
-from lxml import etree
+import xml.etree.ElementTree as etree
# matchAPIProfile - returns whether an API and profile
# being generated matches an element's profile
# required - should this feature be defined during header generation
# (has it been removed by a profile or version)?
# declared - has this feature been defined already?
-# elem - lxml.etree Element for this feature
+# elem - etree Element for this feature
# resetState() - reset required/declared to initial values. Used
# prior to generating a new API interface.
class BaseInfo: