diff --git a/.gitignore b/.gitignore index 4d7bf54..3332259 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,4 @@ scripts *.bak *.rc *.cache +MANIFEST diff --git a/README.md b/README.md index 61f07cc..db17b3e 100644 --- a/README.md +++ b/README.md @@ -37,10 +37,9 @@ Compiling for Windows (With MSYS2) * git clone https://github.com/PerryWerneck/python-tn3270.git -6. Build zip file with the modules using the mingw shell +6. Build the extension using setup.py * cd python-tn3270 - * ./autogen.sh - * make zip + * python setup.py build diff --git a/configure.ac b/configure.ac index 48935ec..22e4e09 100644 --- a/configure.ac +++ b/configure.ac @@ -318,6 +318,10 @@ AC_DEFINE_UNQUOTED(PACKAGE_DESCRIPTION,"$app_cv_description") AC_SUBST(OSNAME,$app_cv_osname) AC_SUBST(LIBS) AC_SUBST(DLLEXT) + +CFLAGS="$CFLAGS -DHAVE_CONFIG_H" +CXXFLAGS="$CXXFLAGS -DHAVE_CONFIG_H" + AC_SUBST(CFLAGS) AC_SUBST(CXXFLAGS) AC_SUBST(LDFLAGS) diff --git a/setup.py b/setup.py index 77e51a3..6558d99 100644 --- a/setup.py +++ b/setup.py @@ -1,10 +1,13 @@ from distutils.core import setup, Extension -tn3270 = Extension('tn3270', - define_macros = [('MAJOR_VERSION', '5'), ('MINOR_VERSION', '2')], +tn3270 = Extension( + 'tn3270', + define_macros = [ + ('PACKAGE_NAME', '\"python-tn3270\"'), + ('PACKAGE_VERSION', '\"5.2\"') + ], include_dirs = ['src/include'], libraries = ['ipc3270'], - library_dirs = ['/usr/lib64'], sources = [ 'src/action/type.c', 'src/module/init.c', @@ -22,11 +25,20 @@ tn3270 = Extension('tn3270', 'src/session/misc.cc', 'src/session/set.cc', 'src/session/attributes.cc', - 'src/session/actions.cc' + 'src/session/actions.cc', + 'src/module/windows/init.cc', + 'src/module/windows/tools.cc' ]) setup ( name = 'tn3270', version = '5.2', - description = 'TN3270 module.', + description = 'Python bindings for lib3270/pw3270.', + author = 'Perry Werneck', + author_email = 'perry.werneck@gmail.com', + url = 'https://github.com/PerryWerneck/python-tn3270', + long_description = ''' +This is an extension allowing tn3270 acess for python applications +using lib3270 directly or ipc calls to an enabled pw3270 window. +''', ext_modules = [ tn3270 ]) diff --git a/src/include/py3270.h b/src/include/py3270.h index 48b1aa4..2b3ba49 100644 --- a/src/include/py3270.h +++ b/src/include/py3270.h @@ -31,11 +31,20 @@ #define PY3270_H_INCLUDED + #ifdef HAVE_CONFIG_H + #include + #else + #define PACKAGE_DESCRIPTION "Python bindings for lib3270/pw3270" + #define HAVE_GNUC_VISIBILITY 1 + #endif // HAVE_CONFIG_H + + #ifndef PACKAGE_NAME + #define PACKAGE_NAME "Python-TN3270" + #endif // !PACKAGE_NAME + #define PY_SSIZE_T_CLEAN #include - #include - #if defined(_WIN32) #include diff --git a/src/module/properties.cc b/src/module/properties.cc index 28182bb..1a6d31f 100644 --- a/src/module/properties.cc +++ b/src/module/properties.cc @@ -32,10 +32,18 @@ /*---[ Implement ]----------------------------------------------------------------------------------*/ PyObject * py3270_get_module_version(PyObject *self, PyObject *args) { +#ifdef PACKAGE_VERSION return PyUnicode_FromString(PACKAGE_VERSION); +#else + return PyUnicode_FromString(""); +#endif // PACKAGE_VERSION } PyObject * py3270_get_module_revision(PyObject *self, PyObject *args) { +#ifdef PACKAGE_REVISION return PyLong_FromLong(PACKAGE_REVISION); +#else + return PyLong_FromLong(0); +#endif // PACKAGE_REVISION } diff --git a/src/module/windows/init.cc b/src/module/windows/init.cc index 00cfae1..f20bc54 100644 --- a/src/module/windows/init.cc +++ b/src/module/windows/init.cc @@ -36,10 +36,10 @@ * */ - #include - #include - #include #include + + #if defined(_WIN32) && defined(USING_STATIC_IPC3270) + #include #include #include @@ -47,8 +47,6 @@ #include #include - #ifdef USING_STATIC_IPC3270 - extern "C" { extern __declspec (dllexport) PfnDliHook __pfnDliNotifyHook2; diff --git a/src/module/windows/tools.cc b/src/module/windows/tools.cc index 9cbb124..3e445e4 100644 --- a/src/module/windows/tools.cc +++ b/src/module/windows/tools.cc @@ -27,10 +27,12 @@ * */ - #include +#include /*--[ Implement ]------------------------------------------------------------------------------------*/ +#ifdef _WIN32 + std::string py3270_get_datadir() noexcept { LSTATUS rc; @@ -76,3 +78,5 @@ return string(datadir); } +#endif // _WIN32 + -- libgit2 0.21.2