2 # A distutils setup script to create py2exe binaries for buildbot.
3 # Both a service and standard executable are created.
13 from os
.path
import dirname
, join
, abspath
, exists
, splitext
15 this_dir
= abspath(dirname(__file__
))
16 bb_root_dir
= abspath(join(this_dir
, "..", ".."))
18 from distutils
.core
import setup
22 # We try and bundle *all* modules in the following packages:
23 for package
in ["buildbot.changes", "buildbot.process", "buildbot.status"]:
25 p
= sys
.modules
[package
]
26 for fname
in os
.listdir(p
.__path
__[0]):
27 base
, ext
= splitext(fname
)
28 if not fname
.startswith("_") and ext
== ".py":
29 includes
.append(p
.__name
__ + "." + base
)
31 # Other misc modules dynamically imported, so missed by py2exe
36 twisted.internet.win32eventreactor
37 twisted.web.resource""".split())
39 # Turn into "," sep py2exe requires
40 includes
= ",".join(includes
)
42 py2exe_options
= {"bundle_files": 1,
46 # Each "target" executable we create
48 "script": join(bb_root_dir
, "bin", "buildbot"),
50 # Due to the way py2exe works, we need to rebuild the service code as a
51 # normal console process - this will be executed by the service itself.
54 "modules": ["buildbot_service"],
55 "cmdline_style": "custom",
58 # We use the py2exe "bundle" option, so servicemanager.pyd
59 # (which has the message resources) does not exist. Take a copy
60 # of it with a "friendlier" name. The service runtime arranges for this
64 msg_file
= join(tempfile
.gettempdir(), "buildbot.msg")
65 shutil
.copy(servicemanager
.__file
__, msg_file
)
69 ["", [join(bb_root_dir
, "buildbot", "status", "web", "classic.css")]],
70 ["", [join(bb_root_dir
, "buildbot", "buildbot.png")]],
74 setup(name
="buildbot",
75 # The buildbot script as a normal executable
76 console
=[buildbot_target
],
77 service
=[service_target
],
78 options
={'py2exe': py2exe_options
},
79 data_files
= data_files
,
80 zipfile
= "buildbot.library", # 'library.zip' invites trouble :)