Skip to content

Commit

Permalink
1.9.5
Browse files Browse the repository at this point in the history
  • Loading branch information
bsrdjan committed Dec 23, 2016
1 parent 6967a88 commit f9d57f8
Show file tree
Hide file tree
Showing 39 changed files with 3,173 additions and 463 deletions.
62 changes: 62 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
OS := $(shell uname)
VERSION = `cat VERSION`
default:
@echo
@echo "Available tasks:"
@echo
@echo "inst - (re)installs dependencies"
@echo "wheel - build & install wheel"
@echo "egg - build & install egg"
@echo "test - test"

.PHONY: inst
inst: inst2 inst3

.PHONY: inst2
inst2: pip2 install --user cython pytest

.PHONY: inst3
inst3: pip3 install --user cython pytest

.PHONY: test
test: test2 test3

.PHONY: test2
test2:
python2 -m pytest -vv

.PHONY: test3
test3:
python3 -m pytest -vv

.PHONY: wheel
wheel: wheel2 wheel3

.PHONY: wheel2
wheel2: wheel2
-yes | pip2 uninstall pyrfc
python2 setup.py bdist_wheel
pip2 install --user dist/pyrfc-$(VERSION)-cp27-cp27mu-linux_x86_64.whl
#pip2 install --user dist/pyrfc-$(VERSION)-cp35-cp35m-win_amd64.whl

.PHONY: wheel3
wheel3: wheel3
-yes | pip3 uninstall pyrfc
python3 setup.py bdist_wheel
pip3 install --user dist/pyrfc-$(VERSION)-cp35-cp35m-linux_x86_64.whl
#pip2 install --user dist/pyrfc-$(VERSION)-cp27-cp27m-win_amd64.whl

.PHONY: egg
egg: egg2 egg3

.PHONY: egg2
egg2:
-yes | pip2 uninstall pyrfc
python2 setup.py bdist_egg
python2 setup.py install --user

.PHONY: egg3
egg3:
-yes | pip3 uninstall pyrfc
python3 setup.py bdist_egg
python3 setup.py install --user
2 changes: 1 addition & 1 deletion VERSION
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.9.4
1.9.5
Binary file added dist/pyrfc-1.9.5-cp27-cp27m-win_amd64.whl
Binary file not shown.
Binary file added dist/pyrfc-1.9.5-cp27-cp27mu-linux_x86_64.whl
Binary file not shown.
Binary file added dist/pyrfc-1.9.5-cp35-cp35m-linux_x86_64.whl
Binary file not shown.
Binary file added dist/pyrfc-1.9.5-cp35-cp35m-win_amd64.whl
Binary file not shown.
Binary file added dist/pyrfc-1.9.5-py2.7-linux-x86_64.egg
Binary file not shown.
Binary file added dist/pyrfc-1.9.5-py2.7-win-amd64.egg
Binary file not shown.
Binary file added dist/pyrfc-1.9.5-py3.5-linux-x86_64.egg
Binary file not shown.
Binary file added dist/pyrfc-1.9.5-py3.5-win-amd64.egg
Binary file not shown.
Empty file modified material/RFCTable.py
100644 → 100755
Empty file.
Empty file modified material/error_test.py
100644 → 100755
Empty file.
Empty file modified material/kjona_getRcAsString_gcc_call.txt
100644 → 100755
Empty file.
Empty file modified material/sapnwrfc.cfg
100644 → 100755
Empty file.
Empty file modified material/serverExamples.py
100644 → 100755
Empty file.
26 changes: 26 additions & 0 deletions material/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

DSP = {
"user" : "demo",
"passwd" : "welcome",
"ashost" : "10.68.104.164",
"sysnr" : "00",
"client" : "620",
"lang" : "EN"
}

from platform import system, release
from sys import version_info
from pyrfc import *


conn = Connection(**DSP)
dates = conn.call('BAPI_USER_GET_DETAIL', USERNAME='demo')['LASTMODIFIED']
d = dates['MODDATE']
t = dates['MODTIME']
del conn

conn = Connection(config={'dtime': True}, **DSP)
dates = conn.call('BAPI_USER_GET_DETAIL', USERNAME='demo')['LASTMODIFIED']
dd = dates['MODDATE']
dt = dates['MODTIME']

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[pytest]
testpaths = tests
173 changes: 88 additions & 85 deletions setup.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,85 +1,88 @@

import os
import sys
from setuptools import setup, find_packages
from distutils.extension import Extension
# Cython import
# Note: Historically, the default setup.py did _not_ contain cython requirements.
# To build just the extensions inplace, use:
# python setup.py build_ext --inplace
CYTHON_VERSION = '0.25.2' # fixed to assure conscious change of version.
try:
import Cython.Distutils
except ImportError:
sys.exit("Cython not installed. Please install version {}.".format(CYTHON_VERSION))

# 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.")
# Python sources
PYTHONSOURCE = os.environ.get('PYTHONSOURCE')
if not PYTHONSOURCE:
sys.exit("Environment variable PYTHONSOURCE not set. Please specify this variable with the root directory of the PYTHONSOURCE Library.")


NAME = 'pyrfc'
here = os.path.abspath(os.path.dirname(__file__))

def _read(name):
f = open(os.path.join(here, name))
return f.read()

if sys.platform.startswith('linux'):
LIBS = ['sapnwrfc', 'sapucum']
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'):
LIBS = ['sapnwrfc', 'libsapucum']
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 = ['-L{}\\lib'.format(SAPNWRFC_HOME)] # JK: Does not work with MS VS8.0 Linker, works with MinGW?
LINK_ARGS = ['-LIBPATH:{}\\lib'.format(SAPNWRFC_HOME), '-LIBPATH:{}\\PCbuild'.format(PYTHONSOURCE)]

pyrfc = Extension( '%s._%s' % (NAME, NAME)
, ['%s/_%s.pyx' % (NAME, NAME)]
, libraries=LIBS
, define_macros=MACROS
, extra_compile_args=COMPILE_ARGS
, extra_link_args=LINK_ARGS
)

# cf. http://docs.python.org/distutils/setupscript.html#additional-meta-data
setup(name=NAME,
version=_read('VERSION').strip(),
description='Python bindings for SAP NetWeaver RFC. Wraps SAP NW RFC Library (libsapnwrfc)',
long_description=_read('README.md'),
classifiers=[ # cf. http://pypi.python.org/pypi?%3Aaction=list_classifiers
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Operating System :: OS Independent',
'Programming Language :: Cython',
'Programming Language :: Python :: 2.7',
'Topic :: Software Development :: Libraries :: Python Modules',
],
keywords='%s sap' % NAME,
author='Srdjan Boskovic',
author_email='[email protected]',
url='https://github.com/SAP/pyrfc',
license='OSI Approved :: Apache Software License',
packages=find_packages(),
package_data={
# If any package contains *.py files, include them:
'': ['*.py']
},
zip_safe=False, # http://packages.python.org/distribute/setuptools.html#setting-the-zip-safe-flag
install_requires=['setuptools'],
setup_requires=['setuptools-git',
'Cython==' + CYTHON_VERSION,
'Sphinx'],
cmdclass={'build_ext': Cython.Distutils.build_ext},
ext_modules=[pyrfc],
test_suite='pyrfc',
)
from codecs import open
import os
import sys
from setuptools import setup, find_packages
from distutils.extension import Extension

CYTHON_VERSION = '0.25.2' # fixed to assure conscious change of version.
try:
import Cython.Distutils
except ImportError:
sys.exit('Cython not installed. Please install version {}.'.format(CYTHON_VERSION))

# 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.')
# Python sources
PYTHONSOURCE = os.environ.get('PYTHONSOURCE')
if not PYTHONSOURCE:
sys.exit('Environment variable PYTHONSOURCE not set. Please specify this variable with the root directory of the PYTHONSOURCE Library.')

NAME = 'pyrfc'
HERE = os.path.abspath(os.path.dirname(__file__))

def _read(name):
with open(os.path.join(HERE, name), 'rb', 'utf-8') as f:
return f.read()

if sys.platform.startswith('linux'):
LIBS = ['sapnwrfc', 'sapucum']
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'):
LIBS = ['sapnwrfc', 'libsapucum']
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)]
else:
sys.exit('Platform not supported: {}.'.format(sys.platform))

# https://docs.python.org/2/distutils/apiref.html
PYRFC_EXT = Extension(
name='%s._%s' % (NAME, NAME)
, sources=['src/%s/_%s.pyx' % (NAME, NAME)]
, libraries=LIBS
, define_macros=MACROS
, extra_compile_args=COMPILE_ARGS
, extra_link_args=LINK_ARGS
)

# cf. 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.rst'),
classifiers=[ # cf. 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',
'Topic :: Software Development :: Libraries :: Python Modules',
],
keywords='%s sap' % NAME,
author='Srdjan Boskovic',
author_email='[email protected]',
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']
},
zip_safe=False, # http://packages.python.org/distribute/setuptools.html#setting-the-zip-safe-flag
install_requires=['setuptools'],
setup_requires=['setuptools-git',
'Cython==' + CYTHON_VERSION,
'Sphinx'],
cmdclass={'build_ext': Cython.Distutils.build_ext},
ext_modules=[PYRFC_EXT],
test_suite='pyrfc',
)
14 changes: 7 additions & 7 deletions sitecustomize.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,21 @@ def fixed_mingw32_init(self, verbose=0, dry_run=0, force=0):
from distutils.cygwinccompiler import CygwinCCompiler
from distutils.cygwinccompiler import get_msvcr
CygwinCCompiler.__init__ (self, verbose, dry_run, force)

# ld_version >= "2.13" support -shared so use it instead of
# -mdll -static
if self.ld_version >= "2.13":
shared_option = "-shared"
else:
shared_option = "-mdll -static"

# A real mingw32 doesn't need to specify a different entry point,
# but cygwin 2.91.57 in no-cygwin-mode needs it.
if self.gcc_version <= "2.91.57":
entry_point = '--entry _DllMain@12'
else:
entry_point = ''

self.set_executables(compiler='gcc -O -Wall',
compiler_so='gcc -mdll -O -Wall',
compiler_cxx='g++ -O -Wall',
Expand All @@ -49,14 +49,14 @@ def fixed_mingw32_init(self, verbose=0, dry_run=0, force=0):
# Maybe we should also append -mthreads, but then the finished
# dlls need another dll (mingwm10.dll see Mingw32 docs)
# (-mthreads: Support thread-safe exception handling on `Mingw32')

# no additional libraries needed
self.dll_libraries=[]

# Include the appropriate MSVC runtime library if Python was built
# with MSVC 7.0 or later.
self.dll_libraries = get_msvcr()


from distutils.cygwinccompiler import Mingw32CCompiler
Mingw32CCompiler.__init__ = fixed_mingw32_init
26 changes: 26 additions & 0 deletions src/pyrfc/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2013 SAP AG.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http: //www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an.
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific.
# language governing permissions and limitations under the License.

# import from internal modules that they could be directly imported from
# the pyrfc package
from pyrfc._exception import RFCError, RFCLibError,\
CommunicationError, LogonError,\
ABAPApplicationError, ABAPRuntimeError,\
ExternalAuthorizationError, ExternalApplicationError, ExternalRuntimeError

from pyrfc._pyrfc import get_nwrfclib_version, Connection, TypeDescription, FunctionDescription, Server

# TODO: define __all__ variable
#

Loading

0 comments on commit f9d57f8

Please sign in to comment.