#!/usr/bin/env python2.7
# C:\Python27_32\python.exe setup_py2exe.py py2exe
from distutils.core import setup
from glob import glob

import os
import py2exe
from setup import SSLYZE_SETUP

data_files = [
    ("Microsoft.VC90.CRT", glob(r'C:\Program Files\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT\*.*'))]

# Trust Stores
plugin_data_files = []
trust_stores_pem_path = os.path.join('sslyze', 'plugins', 'utils', 'trust_store', 'pem_files')
for file in os.listdir(trust_stores_pem_path):
    file = os.path.join(trust_stores_pem_path, file)
    if os.path.isfile(file):  # skip directories
        plugin_data_files.append(file)

data_files.append((os.path.join('utils', 'trust_store', 'pem_files'), plugin_data_files))

sslyze_setup_py2exe = SSLYZE_SETUP.copy()
# Add nassl to the list of packages
sslyze_setup_py2exe['packages'].append('nassl')
sslyze_setup_py2exe.update(
        {
            # Force the packaging of the C extension
            'package_data': {'nassl': ['_nassl.pyd']},
            'console': ['sslyze\\__main__.py'],
            'data_files': data_files,
            'zipfile': None,
            'options': {'py2exe': {
                # 'skip_archive': True,
                'bundle_files': 1,
            }}

        }
)

if __name__ == "__main__":
    setup(**sslyze_setup_py2exe)

@@ -181,16 +181,154 @@
 _SETUP%0A%0A
+# Add lib to the path so py2exe can find the dependencies%0Aimport sys%0Asys.path.insert(1, os.path.join(os.path.dirname(__file__), 'lib'))%0A%0A%0A
 data_fil
@@ -813,32 +813,8 @@
 oin(
-'utils', 'trust_store', 
 'pem
@@ -890,237 +890,141 @@
 y()%0A
-# Add nassl to the list of packages%0Asslyze_setup_py2exe%5B'packages'%5D.append('nassl')%0Asslyze_setup_py2exe.update(%0A        %7B%0A            # Force the packaging of the C extension%0A            'package_data': %7B'nassl': %5B'_nassl.pyd'%5D%7D,
+%0Asslyze_setup_py2exe.update(%0A        %7B%0A            'console': %5Bos.path.join('sslyze', '__main__.py')%5D,%0A            # Add dependencies
 %0A   
@@ -1037,39 +1037,43 @@
    '
-consol
+includ
 e': %5B'
+na
 ssl
-yze%5C%5C__main__.py
+', 'typing', 'enum
 '%5D,%0A
@@ -1265,17 +1265,16 @@
      %7D%7D%0A
-%0A
         

Fix py2exe builds