diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..280d2a5
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,36 @@
+syntax: glob
+
+local.conf
+*.swp
+ws/
+tags/
+.DS_Store/
+pEp.egg-info/
+dist/
+build/
+.pythonhist
+.gnupg
+.lldb
+.pEp_management.db*
+.python_history
+__pycache__/
+test/Laptop/
+test/Library/
+test/Phone/
+test/TestInbox/
+test/Backup/
+test/lib/
+test/imap_settings.py
+venv/
+build-windows/Debug/
+build-windows/Release/
+build-windows/packages/
+build-windows/.vs/
+build-windows/pEpPythonAdapter.vcxproj.*
+launch.json
+settings.json
+# Default ignored files
+.idea/
+docs/build/
+.eggs/
+.tox/
diff --git a/build-windows/pEpPythonAdapter.sln b/build-windows/pEpPythonAdapter.sln
new file mode 100644
index 0000000..91c95e7
--- /dev/null
+++ b/build-windows/pEpPythonAdapter.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.31005.135
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pEpPythonAdapter", "pEpPythonAdapter.vcxproj", "{F7D4314B-C7BA-4117-9AE7-AC5C1492153D}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {F7D4314B-C7BA-4117-9AE7-AC5C1492153D}.Debug|x64.ActiveCfg = Debug|x64
+ {F7D4314B-C7BA-4117-9AE7-AC5C1492153D}.Debug|x64.Build.0 = Debug|x64
+ {F7D4314B-C7BA-4117-9AE7-AC5C1492153D}.Debug|x86.ActiveCfg = Debug|Win32
+ {F7D4314B-C7BA-4117-9AE7-AC5C1492153D}.Debug|x86.Build.0 = Debug|Win32
+ {F7D4314B-C7BA-4117-9AE7-AC5C1492153D}.Release|x64.ActiveCfg = Release|x64
+ {F7D4314B-C7BA-4117-9AE7-AC5C1492153D}.Release|x64.Build.0 = Release|x64
+ {F7D4314B-C7BA-4117-9AE7-AC5C1492153D}.Release|x86.ActiveCfg = Release|Win32
+ {F7D4314B-C7BA-4117-9AE7-AC5C1492153D}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {B63BC9BA-EF76-4FB4-9126-29CBFAD9092C}
+ EndGlobalSection
+EndGlobal
diff --git a/build-windows/pEpPythonAdapter.vcxproj b/build-windows/pEpPythonAdapter.vcxproj
new file mode 100644
index 0000000..66ee151
--- /dev/null
+++ b/build-windows/pEpPythonAdapter.vcxproj
@@ -0,0 +1,112 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 16.0
+ {F7D4314B-C7BA-4117-9AE7-AC5C1492153D}
+ Win32Proj
+
+
+
+ Makefile
+ true
+ v142
+
+
+ Makefile
+ false
+ v142
+
+
+ Makefile
+ true
+ v142
+
+
+ Makefile
+ false
+ v142
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ nmake /F "$(ProjectDir)..\make.mak" all
+
+
+ WIN32;_DEBUG;_DLL;$(NMakePreprocessorDefinitions)
+ nmake /F "$(ProjectDir)..\make.mak" clean
+ $(VC_SourcePath);$(ProjectDir)..
+
+
+ make.cmd
+ pEpPythonAdapter.exe
+ _DEBUG;$(NMakePreprocessorDefinitions)
+
+
+ nmake /F "$(ProjectDir)..\make.mak" all
+
+
+ WIN32;NDEBUG;_DLL;$(NMakePreprocessorDefinitions)
+ nmake /F "$(ProjectDir)..\make.mak" clean
+ $(VC_SourcePath);$(ProjectDir)..
+
+
+ make.cmd
+ pEpPythonAdapter.exe
+ NDEBUG;$(NMakePreprocessorDefinitions)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
+
+
+
+
+
+
\ No newline at end of file
diff --git a/build-windows/packages.config b/build-windows/packages.config
new file mode 100644
index 0000000..e974096
--- /dev/null
+++ b/build-windows/packages.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/make.mak b/make.mak
new file mode 100644
index 0000000..9dfc3af
--- /dev/null
+++ b/make.mak
@@ -0,0 +1,27 @@
+# build dirs
+BUILD_DIR = $(ProjectDir)..\build
+DIST_DIR = $(ProjectDir)..\dist
+
+# create wheel and egg package in dist
+dist: dist-whl dist-egg
+
+# create wheel package in dist
+dist-whl: compile
+ PY -3.8-32 setup.py bdist_wheel
+
+# create egg package in dist
+dist-egg: compile
+ PY -3.8-32 setup.py bdist_egg
+
+# build the module into build
+compile:
+ CD..
+ PY -3.8-32 setup.py build_ext
+
+# delete output directories
+clean:
+ @if exist $(BUILD_DIR) rmdir /S /Q $(BUILD_DIR)
+ @if exist $(DIST_DIR) rmdir /S /Q $(DIST_DIR)
+
+# create directories and build application
+all: clean dist
diff --git a/setup.py b/setup.py
index 34ca5d7..0fc446b 100644
--- a/setup.py
+++ b/setup.py
@@ -42,53 +42,44 @@ class BuildExtCommand(build_ext):
self.prefix = getattr(self, "prefix=", None)
def windowsGetInstallLocation(self):
- # Note: should be installed to 'C:\Program Files (x86)' while a 32-bit distro
- # TODO: Try desktop adapter location first, then COM server
- # FIXME: This is wrong, we should chase the COM server, not the Outlook Plugin (even if they're in the same place)
- reg_path = "Software\\Microsoft\\Office\\Outlook\\Addins\\pEp"
- KeyName = 'FileName'
+ reg_path = "SOFTWARE\\Classes\\TypeLib\\{564A4350-419E-47F1-B0DF-6FCCF0CD0BBC}\\1.0\\0\\win32"
+ KeyName = None
regKey = None
pEpLog("Registry Lookup:", reg_path, KeyName)
try:
regKey = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, reg_path, 0, winreg.KEY_READ)
# Keys: Description, FileName, FriendlyName, LoadBehavior
- com_server, regtype = winreg.QueryValueEx(regKey, KeyName)
- winreg.CloseKey(regKey)
- except WindowsError:
- pEpLog("Unknown Error")
+ com_server, _ = winreg.QueryValueEx(regKey, KeyName)
+ except WindowsError as error:
+ pEpLog("Error ocurred: " + error)
com_server = None
finally:
if winreg:
winreg.CloseKey(regKey)
- # \\bin\\COM_Server.exe
dirname = os.path.dirname
ret = dirname(dirname(com_server))
pEpLog("Value:", ret)
return ret
- def get_build_info_winnt(self):
+ def windowsGetBoostDirs(self):
+ for dir in [f.path for f in os.scandir(join(os.getcwd(), 'build-windows', 'packages')) if f.is_dir()]:
+ if 'boost.' in dir or 'boost_python' in dir or 'boost_locale' in dir:
+ yield join(dir, 'lib', 'native'), join(dir, 'lib', 'native', 'include')
+
+ def get_build_info_win32(self):
home = environ.get('PER_USER_DIRECTORY') or environ.get('USERPROFILE')
- sys_root = environ.get('SystemRoot')
- profile_root = environ.get('AppData')
- local_root = environ.get('LocalAppData')
inst_prefix = self.windowsGetInstallLocation()
sys_includes = [
- join(inst_prefix, 'include'),
- join(profile_root, 'pEp', 'include'),
- join(local_root, 'pEp', 'include'),
- join(sys_root, 'pEp', 'include'),
- ]
+ join(inst_prefix),
+ ] + [d[1] for d in self.windowsGetBoostDirs()]
sys_libdirs = [
- join(inst_prefix, 'bin'),
- join(profile_root, 'pEp', 'bin'),
- join(local_root, 'pEp', 'bin'),
- join(sys_root, 'pEp', 'bin'),
- ]
+ join(inst_prefix, 'Release')
+ ] + [d[0] for d in self.windowsGetBoostDirs()]
libs = [
'pEpEngine',
- 'pEpAdapter',
- 'boost_python37-mt',
- 'boost_locale-mt'
+ 'libpEpAdapter',
+ 'boost_python38-vc142-mt-x32-1_72',
+ 'boost_locale-vc142-mt-x32-1_72'
]
return (home, sys_includes, sys_libdirs, libs)
@@ -135,8 +126,8 @@ class BuildExtCommand(build_ext):
pEpLog("sys.platform: ", sys.platform)
# get build information for platform
- if sys.platform == 'winnt':
- build_info = self.get_build_info_winnt()
+ if sys.platform == 'win32':
+ build_info = self.get_build_info_win32()
elif sys.platform == 'darwin':
build_info = self.get_build_info_darwin()
elif sys.platform == 'linux':
@@ -172,7 +163,7 @@ class BuildExtCommand(build_ext):
libdirs += sys_libdirs
# Compile flags
- compile_flags = ['-std=c++14', '-fpermissive']
+ compile_flags = ['/std:c++14', '/permissive'] if sys.platform == 'win32' else [ '--std:c++14', '--fpermissive' ]
if self.debug:
pEpLog("debug mode")
compile_flags += ['-O0', '-g', '-UNDEBUG']
@@ -193,8 +184,8 @@ class BuildExtCommand(build_ext):
build_ext.run(self)
-if sys.platform == 'winnt':
- if sys.version_info[0] >= 3:
+if sys.platform == 'win32':
+ if sys.version_info[0] >= 3:
import winreg
else:
import _winreg as winreg
diff --git a/src/pEp/native_pEp/str_attr.hh b/src/pEp/native_pEp/str_attr.hh
index 978d22b..5e084ad 100644
--- a/src/pEp/native_pEp/str_attr.hh
+++ b/src/pEp/native_pEp/str_attr.hh
@@ -12,6 +12,7 @@
#include
#include
#include
+#include
namespace pEp {
namespace PythonAdapter {