source: ogAgent-Git/src/setup.py @ 98fc98d

configure-ptt-chedecorare-oglive-methodsejecutarscript-b64fix-cfg2objfixes-winlgromero-filebeatmainmodulesnew-browserno-ptt-paramogadmcliogadmclient-statusogagent-jobsogagent-macosogcore1ogliveoglogoglog2override-moduleping1ping2ping3ping4py3-winpython3qndtestreport-progresstlsunification2unification3versionswindows-fixes
Last change on this file since 98fc98d was 11f7a07, checked in by ramon <ramongomez@…>, 9 years ago

#718: Integrar código fuente de agente OGAgent en rama de desarrollo.

git-svn-id: https://opengnsys.es/svn/branches/version1.1@4865 a21b9725-9963-47de-94b9-378ad31fedc9

  • Property mode set to 100644
File size: 4.6 KB
RevLine 
[11f7a07]1# -*- coding: utf-8 -*-
2#
3# Copyright (c) 2014 Virtual Cable S.L.
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without modification,
7# are permitted provided that the following conditions are met:
8#
9#    * Redistributions of source code must retain the above copyright notice,
10#      this list of conditions and the following disclaimer.
11#    * Redistributions in binary form must reproduce the above copyright notice,
12#      this list of conditions and the following disclaimer in the documentation
13#      and/or other materials provided with the distribution.
14#    * Neither the name of Virtual Cable S.L. nor the names of its contributors
15#      may be used to endorse or promote products derived from this software
16#      without specific prior written permission.
17#
18# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
29'''
30@author: Adolfo Gómez, dkmaster at dkmon dot com
31'''
32
33VERSION = '1.0.0'
34
35# ModuleFinder can't handle runtime changes to __path__, but win32com uses them
36try:
37    # py2exe 0.6.4 introduced a replacement modulefinder.
38    # This means we have to add package paths there, not to the built-in
39    # one.  If this new modulefinder gets integrated into Python, then
40    # we might be able to revert this some day.
41    # if this doesn't work, try import modulefinder
42    try:
43        import py2exe.mf as modulefinder
44    except ImportError:
45        import modulefinder
46    import win32com, sys
47    for p in win32com.__path__[1:]:
48        modulefinder.AddPackagePath("win32com", p)
49    for extra in ["win32com.shell"]:  # ,"win32com.mapi"
50        __import__(extra)
51        m = sys.modules[extra]
52        for p in m.__path__[1:]:
53            modulefinder.AddPackagePath(extra, p)
54except ImportError:
55    # no build path setup, no worries.
56    pass
57
58from distutils.core import setup
59import py2exe
60import sys
61import os
62
63sys.argv.append('py2exe')
64
65def get_requests_cert_file():
66    """Add Python requests .pem file for installers."""
67    import requests
68    f = os.path.join(os.path.dirname(requests.__file__), 'cacert.pem')
69    return f
70
71
72class Target:
73
74    def __init__(self, **kw):
75        self.__dict__.update(kw)
76        # for the versioninfo resources
77        self.version = VERSION
78        self.name = 'OGAgentService'
79        self.description = 'OpenGnsys Agent Service'
80        self.author = 'Adolfo Gomez'
81        self.url = 'http://www.opengnsys.es'
82        self.company_name = "VirtualCable S.L.U."
83        self.copyright = "(c) 2014 VirtualCable S.L.U."
84        self.name = "OpenGnsys Agent"
85
86# Now you need to pass arguments to setup
87# windows is a list of scripts that have their own UI and
88# thus don't need to run in a console.
89
90
91udsservice = Target(
92    description='OpenGnsys Agent Service',
93    modules=['opengnsys.windows.OGAgentService'],
94    icon_resources=[(0, 'img\\oga.ico'), (1, 'img\\oga.ico')],
95    cmdline_style='pywin32'
96)
97
98# Some test_modules are hidden to py2exe by six, we ensure that they appear on "includes"
99HIDDEN_BY_SIX = ['SocketServer', 'SimpleHTTPServer', 'urllib']
100
101setup(
102    windows=[
103        {
104            'script': 'OGAgentUser.py',
105            'icon_resources': [(0, 'img\\oga.ico'), (1, 'img\\oga.ico')]
106        },
107    ],
108    console=[
109        {
110            'script': 'OGAServiceHelper.py'
111        }
112    ],
113    service=[udsservice],
114    data_files=[('', [get_requests_cert_file()]),('cfg', ['cfg/ogagent.cfg', 'cfg/ogclient.cfg'])],
115    options={
116        'py2exe': {
117            'bundle_files': 3,
118            'compressed': True,
119            'optimize': 2,
120            'includes': [ 'sip', 'PyQt4', 'win32com.shell', 'requests'] + HIDDEN_BY_SIX,
121            'excludes': [ 'doctest', 'unittest' ],
122            'dll_excludes': ['msvcp90.dll'],
123            'dist_dir': '..\\bin',
124        }
125    },
126    name='OpenGnsys Agent',
127    version=VERSION,
128    description='OpenGnsys Agent',
129    author='Adolfo Gomez',
130    author_email='agomez@virtualcable.es',
131    zipfile='OGAgent.zip',
132)
Note: See TracBrowser for help on using the repository browser.