Selaa lähdekoodia

remove dependency on lxml

Julius Pfrommer 8 vuotta sitten
vanhempi
commit
3268be3b9d
7 muutettua tiedostoa jossa 10 lisäystä ja 22 poistoa
  1. 1 6
      CMakeLists.txt
  2. 1 1
      Dockerfile
  3. 2 2
      TinyDockerfile
  4. 1 2
      appveyor.yml
  5. 1 3
      doc/building.rst
  6. 4 7
      tools/generate_datatypes.py
  7. 0 1
      tools/travis/travis_osx_before_install.sh

+ 1 - 6
CMakeLists.txt

@@ -6,13 +6,8 @@ project(open62541 C)
 # Check Dependencies #
 ######################
 
-# Find Python and Python-lxml
+# Find Python
 find_package(PythonInterp REQUIRED)
-execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import lxml"
-                RESULT_VARIABLE IMPORT_LXML_RESULT)
-if(NOT "${IMPORT_LXML_RESULT}" STREQUAL "0")
-    message(FATAL_ERROR "Python-lxml is not installed.")
-endif()
 
 # Check for git
 find_package(Git)

+ 1 - 1
Dockerfile

@@ -1,5 +1,5 @@
 FROM alpine:3.3
-RUN apk add --no-cache cmake gcc musl-dev python py-lxml make && rm -rf /var/cache/apk/*
+RUN apk add --no-cache cmake gcc musl-dev python make && rm -rf /var/cache/apk/*
 ADD . /tmp/open62541
 WORKDIR /tmp/open62541/build
 RUN cmake -D UA_ENABLE_AMALGAMATION=true /tmp/open62541 && make

+ 2 - 2
TinyDockerfile

@@ -1,11 +1,11 @@
 FROM alpine:3.3
 ADD . /tmp/open62541
 WORKDIR /tmp/open62541/build
-RUN apk add --no-cache cmake gcc musl-dev python py-lxml make && rm -rf /var/cache/apk/* && \
+RUN apk add --no-cache cmake gcc musl-dev python make && rm -rf /var/cache/apk/* && \
     cmake -D UA_ENABLE_AMALGAMATION=true /tmp/open62541 && \
     make && \
     cp *.h /usr/include/ && \
     cp *.so /usr/lib && \
     cp *.a /usr/lib && \
     make clean && \
-    apk del cmake gcc musl-dev python py-lxml make
+    apk del cmake gcc musl-dev python make

+ 1 - 2
appveyor.yml

@@ -13,11 +13,10 @@ build_script:
 - md build
 - cd build
 - echo "Testing cygwin"
-- C:\cygwin\setup-x86.exe -q -P cmake,python-lxml
+- C:\cygwin\setup-x86.exe -q -P cmake
 - cmd: '%CYG_ROOT%/bin/bash --login -lc "cd /cygdrive/c/projects/open62541/build; cmake -DUA_BUILD_EXAMPLESERVER:BOOL=ON -DUA_BUILD_EXAMPLECLIENT:BOOL=ON -DUA_BUILD_EXAMPLES:BOOL=ON -G\"Unix Makefiles\" ..; make"'
 - cd ..
 - rd /s /q build
-- set STATICBUILD=true && python -m pip install lxml
 - md build
 - cd build
 - echo "Testing MinGW32"

+ 1 - 3
doc/building.rst

@@ -17,7 +17,7 @@ Building with CMake on Ubuntu or Debian
 
 .. code-block:: bash
    
-   sudo apt-get install git build-essential gcc pkg-config cmake python python-lxml
+   sudo apt-get install git build-essential gcc pkg-config cmake python
 
    # enable additional features
    sudo apt-get install libexpat1-dev # for XML-encodingi
@@ -44,7 +44,6 @@ replace the compiler selection in the call to CMake.
 - Download and install
 
   - Python 2.7.x (Python 3.x should work, too): https://python.org/downloads
-  - Python lxml: https://pypi.python.org/pypi/lxml
   - CMake: http://www.cmake.org/cmake/resources/software.html
   - Microsoft Visual Studio 2015 Community Edition: https://www.visualstudio.com/products/visual-studio-community-vs
     
@@ -76,7 +75,6 @@ Building on OS X
 
    brew install cmake
    brew install libxml2
-   pip install lxml
    brew install check # for unit tests
    brew install userspace-rcu # for multi-threading support
    brew install graphviz doxygen # for documentation generation

+ 4 - 7
tools/generate_datatypes.py

@@ -5,10 +5,9 @@ import platform
 import getpass
 from collections import OrderedDict
 import re
-from lxml import etree
+import xml.etree.ElementTree as etree
 import itertools
 import argparse
-from pprint import pprint
 
 types = OrderedDict() # contains types that were already parsed
 typedescriptions = {} # contains type nodeids
@@ -239,10 +238,6 @@ class StructType(Type):
 #########################
 
 def parseTypeDefinitions(outname, xmlDescription):
-    ns = {"opc": "http://opcfoundation.org/BinarySchema/"}
-    tree = etree.parse(xmlDescription)
-    typeSnippets = tree.xpath("/opc:TypeDictionary/*[not(self::opc:Import)]", namespaces=ns)
-
     def typeReady(element):
         "Are all member types defined?"
         for child in element:
@@ -262,7 +257,9 @@ def parseTypeDefinitions(outname, xmlDescription):
         return False
 
     snippets = {}
-    for typeXml in typeSnippets:
+    for typeXml in etree.parse(xmlDescription).getroot():
+        if not typeXml.get("Name"):
+            continue
         name = typeXml.get("Name")
         snippets[name] = typeXml
 

+ 0 - 1
tools/travis/travis_osx_before_install.sh

@@ -10,7 +10,6 @@ else
 	brew install userspace-rcu
 	brew install valgrind
 
-	pip install --user lxml
 	pip install --user sphinx
 	pip install --user breathe
 	pip install --user sphinx_rtd_theme