From 50b87e28cfca6fa97e85caca72c01643d679f86d Mon Sep 17 00:00:00 2001 From: bsrdjan Date: Mon, 4 Nov 2019 10:32:53 +0100 Subject: [PATCH] 2.0.0 --- CHANGES | 4 +- setup-new.py | 173 ------------------------------------------- src/pyrfc/_pyrfc.pyx | 5 +- 3 files changed, 6 insertions(+), 176 deletions(-) delete mode 100755 setup-new.py diff --git a/CHANGES b/CHANGES index 014550b..42265e2 100644 --- a/CHANGES +++ b/CHANGES @@ -6,7 +6,9 @@ Change log - Documentation - macOS rpath fix/show scripts -- Tables and structure parameters type check +- Tables and structure parameters dict and list type check +- Type checks, unit tests +- sitecustomize removed, closes 136 1.9.99 (2019-10-25) ------------------- diff --git a/setup-new.py b/setup-new.py deleted file mode 100755 index 7ae82e4..0000000 --- a/setup-new.py +++ /dev/null @@ -1,173 +0,0 @@ -import os -import sys -import Cython -from Cython.Build import cythonize -from setuptools import setup, find_packages -from distutils.extension import Extension - -from setuptools import find_packages - -# SAP NW RFC SDK dependency -SAPNWRFC_HOME = os.environ.get("SAPNWRFC_HOME") -if not SAPNWRFC_HOME: - sys.exit( - "Environment variable SAPNWRFC_HOME not set. Please specify this variable with the root directory of the SAP NW RFC Library." - ) -SAPNWRFC_INCLUDE_DIR = SAPNWRFC_HOME + "/include" - -NAME = "pyrfc" -HERE = os.path.abspath(os.path.dirname(__file__)) - - -def _read(name): - print(name, HERE) - with open(os.path.join(HERE, name), "r", encoding="utf-8") as f: - return f.read() - - -PYTHONSOURCE = "/Users/d037732/.pyenv/versions/3.7.4/include/python3.7m" -INCLUDE_DIRS = [SAPNWRFC_INCLUDE_DIR, PYTHONSOURCE] -LIBRARIES = ["sapnwrfc", "sapucum"] -if sys.platform.startswith("linux"): - MACROS = [ - ("NDEBUG", None), - ("_LARGEFILE_SOURCE", None), - ("_FILE_OFFSET_BITS", 64), - ("SAPonUNIX", None), - ("SAPwithUNICODE", None), - ("SAPwithTHREADS", None), - ("SAPonLIN", None), - ] - COMPILE_ARGS = [ - "-Wall", - "-O2", - "-fexceptions", - "-funsigned-char", - "-fno-strict-aliasing", - "-Wall", - "-Wno-uninitialized", - "-Wcast-align", - "-fPIC", - "-pthread", - "-minline-all-stringops", - "-I{}/include".format(SAPNWRFC_HOME), - ] - LINK_ARGS = ["-L{}/lib".format(SAPNWRFC_HOME)] -elif sys.platform.startswith("win"): - MACROS = [ - ("_LARGEFILE_SOURCE", None), - ("SAPwithUNICODE", None), - ("_CONSOLE", None), - ("WIN32", None), - ("SAPonNT", None), - ("SAP_PLATFORM_MAKENAME", "ntintel"), - ("UNICODE", None), - ("_UNICODE", None), - ] - COMPILE_ARGS = [ - "-I{}\\include".format(SAPNWRFC_HOME), - "-I{}\\Include".format(PYTHONSOURCE), - "-I{}\\Include\\PC".format(PYTHONSOURCE), - ] - LINK_ARGS = [ - "-LIBPATH:{}\\lib".format(SAPNWRFC_HOME), - "-LIBPATH:{}\\PCbuild".format(PYTHONSOURCE), - ] -elif sys.platform.startswith("darwin"): - MACOS_VERSION_MIN = "10.10" - # unicode paths fix - # https://apple.stackexchange.com/questions/337940/why-is-usr-include-missing-i-have-xcode-and-command-line-tools-installed-moja - # https://github.com/neovim/neovim/issues/9050#issuecomment-424417456 - # $ MACOS_UNICODE_INC=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/unicode - # $ sudo ln -s $MACOS_UNICODE_INC/uchar.h $SAPNWRFC_HOME/include - # $ sudo ln -s $MACOS_UNICODE_INC $SAPNWRFC_HOME/include/unicode - MACROS = [ - ("NDEBUG", None), - ("_LARGEFILE_SOURCE", None), - ("_FILE_OFFSET_BITS", 64), - ("SAPonUNIX", None), - ("SAPwithUNICODE", None), - ("SAPwithTHREADS", None), - ("SAPonLIN", None), - ] - COMPILE_ARGS = [ - "-Wall", - "-O2", - "-fexceptions", - "-funsigned-char", - "-fno-strict-aliasing", - "-Wall", - "-Wno-uninitialized", - "-Wcast-align", - "-fPIC", - "-pthread", - "-minline-all-stringops", - "-isystem", - "-std=c++11", - "-mmacosx-version-min={}".format(MACOS_VERSION_MIN), - "-I{}/include".format(SAPNWRFC_HOME), - ] - LINK_ARGS = [ - "-L{}/lib".format(SAPNWRFC_HOME), - "-stdlib=libc++", - "-mmacosx-version-min={}".format(MACOS_VERSION_MIN), - # https://stackoverflow.com/questions/6638500/how-to-specify-rpath-in-a-makefile - "-Wl,-rpath,{}/lib".format(SAPNWRFC_HOME), - ] -else: - sys.exit("Platform not supported: {}.".format(sys.platform)) - -# https://docs.python.org/3.7/distutils/apiref.html -extension = Extension( - language="c++", - name="%s._%s" % (NAME, NAME), - sources=["src/%s/_%s.pyx" % (NAME, NAME)], - include_dirs=INCLUDE_DIRS, - libraries=LIBRARIES, - define_macros=MACROS, - extra_compile_args=COMPILE_ARGS, - extra_link_args=LINK_ARGS, -) - - -# http://docs.python.org/distutils/setupscript.html#additional-meta-data -setup( - name=NAME, - version=_read("VERSION").strip(), - description="Python bindings for SAP NetWeaver RFC Library (libsapnwrfc)", - long_description=_read("README.md"), - # long_description_content_type="text/markdown", - classifiers=[ # http://pypi.python.org/pypi?%3Aaction=list_classifiers - "Development Status :: 4 - Beta", - "Intended Audience :: Developers", - "Natural Language :: English", - "License :: OSI Approved :: Apache Software License", - "Operating System :: OS Independent", - "Programming Language :: Cython", - "Programming Language :: Python", - "Programming Language :: Python :: 2.7", - "Programming Language :: Python :: 3.5", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - "Topic :: Software Development :: Libraries :: Python Modules", - ], - keywords="%s sap" % NAME, - author="Srdjan Boskovic", - author_email="srdjan.boskovic@sap.com", - url="https://github.com/SAP/pyrfc", - license="OSI Approved :: Apache Software License", - packages=find_packages("src"), - package_dir={"": "src"}, - package_data={ - # If any package contains *.py files, include them: - "": ["*.py"] - }, - # http://packages.python.org/distribute/setuptools.html#setting-the-zip-safe-flag - zip_safe=False, - install_requires=["setuptools"], - setup_requires=["setuptools-git", "Cython", "Sphinx"], - cmdclass={"build_ext": Cython.Build.build_ext}, - # https://cython.readthedocs.io/en/latest/src/userguide/source_files_and_compilation.html#cythonize-arguments - ext_modules=cythonize(extension, compiler_directives={"language_level": "3"}), - test_suite="pyrfc", -) diff --git a/src/pyrfc/_pyrfc.pyx b/src/pyrfc/_pyrfc.pyx index 86842ac..8b5fddb 100755 --- a/src/pyrfc/_pyrfc.pyx +++ b/src/pyrfc/_pyrfc.pyx @@ -1677,8 +1677,9 @@ cdef fillTable(RFC_TYPE_DESC_HANDLE typeDesc, RFC_TABLE_HANDLE container, lines) fillStructureField(typeDesc, lineHandle, name, value) else: fillStructureField(typeDesc, lineHandle, '', line) + i += 1 # https://stackoverflow.com/questions/33626623/the-most-efficient-way-to-remove-first-n-elements-in-a-list - i += 1 # del lines[:1] + # del lines[:1] cdef fillVariable(RFCTYPE typ, RFC_FUNCTION_HANDLE container, SAP_UC* cName, value, RFC_TYPE_DESC_HANDLE typeDesc): cdef RFC_RC rc @@ -1771,7 +1772,7 @@ cdef fillVariable(RFCTYPE typ, RFC_FUNCTION_HANDLE container, SAP_UC* cName, val else: rc = RFC_OK elif typ == RFCTYPE_TIME: - if (value): # not None or empty + if value: # not None or empty format_ok = True if type(value) is datetime.time: cValue = fillString('{:02d}{:02d}{:02d}'.format(value.hour, value.minute, value.second))