From b44a00b3b5fc6606134105c58d06f80bb4a55415 Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Wed, 4 Dec 2019 16:22:46 -0300 Subject: [PATCH] Testing python build using windows + MSVC. --- .gitignore | 1 + .vscode/settings.json | 3 +++ setup.py | 9 +++++++++ testprograms/sample.py | 36 +++++++++++++++++------------------- 4 files changed, 30 insertions(+), 19 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.gitignore b/.gitignore index 3332259..ebba25b 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,4 @@ scripts *.rc *.cache MANIFEST +dist \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..f99cfdd --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "python.pythonPath": "C:\\Program Files\\Python37\\python.exe" +} \ No newline at end of file diff --git a/setup.py b/setup.py index 49b87b3..e54762b 100644 --- a/setup.py +++ b/setup.py @@ -3,11 +3,19 @@ import platform include_dirs = ['src/include'] library_dirs = [] +extra_link_args = [] if platform.system() == 'Windows': include_dirs.append(os.getenv('PW3270_SDK_PATH') + '/include') library_dirs.append(os.getenv('PW3270_SDK_PATH') + '/lib') + with open(os.getenv('PW3270_SDK_PATH') + "\\lib3270.mak") as file: + text = file.readlines() + + for line in text: + if line.startswith("LIB3270_NAME="): + extra_link_args.append("/delayload:" + line.split("=")[1].rstrip("\r").rstrip("\n") + ".dll") + tn3270 = Extension( 'tn3270', define_macros = [ @@ -17,6 +25,7 @@ tn3270 = Extension( include_dirs = include_dirs, libraries = ['ipc3270'], library_dirs=library_dirs, + extra_link_args=extra_link_args, sources = [ 'src/action/type.c', 'src/module/init.c', diff --git a/testprograms/sample.py b/testprograms/sample.py index 6c399c3..01fba13 100644 --- a/testprograms/sample.py +++ b/testprograms/sample.py @@ -4,27 +4,25 @@ #import inspect import tn3270 -class Host(tn3270.Session): - - def __init__(self): - - super().__init__(":a") - print("Using tn3270 version " + self.version + " revision " + self.revision) - - def reconnect(self): - if super().reconnect.activatable: - print("Reconnecting...") - super().reconnect().wait(10) - - -host = Host() - -host.reconnect() - +#class Host(tn3270.Session): +# +# def __init__(self): +# +# super().__init__(":a") +# print("Using tn3270 version " + self.version + " revision " + self.revision) +# +# def reconnect(self): +# if super().reconnect.activatable: +# print("Reconnecting...") +# super().reconnect().wait(10) +# +#host = Host() +#host.reconnect() +print("Testing python module") -#print("Using TN3270 Version " + tn3270.version()) -#print(tn3270.revision()) +print("Using TN3270 Version " + tn3270.version()) +print(tn3270.revision()) #session = tn3270.Session("") #session.timeout = 10 -- libgit2 0.21.2