# -*- encoding: utf-8 -*-

import sys
from cx_Freeze import setup, Executable

from pesel2pbn.version import VERSION

base = None
targetName = "pesel2pbn.app"

if sys.platform == "win32":
    base="Win32GUI"
    targetName = "pesel2pbn.exe"


exe = Executable(
    script="pesel2pbn/main.py",
    initScript = None,
    base=base,
    targetName=targetName,
    compress=True,
    copyDependentFiles = True,
    appendScriptToExe = False,
    appendScriptToLibrary = False,
    icon = None
    )

setup(
    name = "pesel2pbn",
    version = VERSION,
    author = 'Michal Pasternak',
    packages = ["pesel2pbn"],
    description = "PESEL2PBN",
    options = {
        "build_exe": {
            "include_msvcr": True,   #skip error msvcr100.dll missing
            "packages": ['pesel2pbn',],
            "includes": [
                "atexit",
                "PyQt5.QtCore",
                "PyQt5.QtGui",
                "PyQt5.QtWidgets",
                "pesel2pbn.pesel2pbn_auto"
            ],
            "include_files": [
                ("C:\Python34\Lib\site-packages\PyQt5\plugins\platforms\qwindows.dll",
                 "platforms\qwindows.dll" )
                ],
            "excludes": [
                '_gtkagg',
                '_tkagg',
                'bsddb',
                'curses',
                'email',
                'pywin.debugger',
                'pywin.debugger.dbgcon',
                'pywin.dialogs',
                'tcl',
                'Tkconstants',
                'Tkinter'],            
        }               
    },
    executables = [exe]
)

@@ -151,16 +151,37 @@
 pbn.app%22
+%0Ainclude_files = None
 %0A%0Aif sys
@@ -259,238 +259,317 @@
 xe%22%0A
-%0A%0Aexe = Executable(%0A    script=%22pesel2pbn/main.py%22,%0A    initScript = None,%0A    base=base,%0A    targetName=targetName,%0A    compress=True,%0A    copyDependentFiles = True,%0A    appendScriptToExe = False,%0A    appendScriptToLibrary = Fals
+    include_files = %5B%0A        (%22%25USERPROFILE%25%5CAppData%5CLocal%5CPrograms%5CPython%5CPython36-32%5CLib%5Csite-packages%5CPyQt5%5CQt%5Cplugins%5Cplatforms%5Cqwindows.dll%22,%0A         %22platforms%5Cqwindows.dll%22 )%0A        %5D,%0A%0A%0Aexe = Executable(%0A    script=%22pesel2pbn/main.py%22,%0A    initScript = None,%0A    base=base,%0A    targetName=targetNam
 e,%0A 
@@ -1128,158 +1128,21 @@
 s%22: 
-%5B%0A                (%22C:%5CPython34%5CLib%5Csite-packages%5CPyQt5%5Cplugins%5Cplatforms%5Cqwindows.dll%22,%0A                 %22platforms%5Cqwindows.dll%22 )%0A                %5D
+include_files
 ,%0A  

Fix win32