diff --git a/master/bin/buildbot b/master/bin/buildbot deleted file mode 100755 index 7295b0074d2..00000000000 --- a/master/bin/buildbot +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env python - -from buildbot.scripts import runner -runner.run() diff --git a/master/contrib/windows/buildbot_service.py b/master/buildbot/scripts/windows_service.py similarity index 98% rename from master/contrib/windows/buildbot_service.py rename to master/buildbot/scripts/windows_service.py index 3dcd9d230e0..f202b0e4180 100755 --- a/master/contrib/windows/buildbot_service.py +++ b/master/buildbot/scripts/windows_service.py @@ -9,23 +9,23 @@ # is working as expected. # # * Install the buildbot service. Execute the command: -# % python buildbot_service.py +# % buildbot_windows_service # To see installation options. You probably want to specify: # + --username and --password options to specify the user to run the # + --startup auto to have the service start at boot time. # # For example: -# % python buildbot_service.py --user mark --password secret \ +# % buildbot_windows_service --user mark --password secret \ # --startup auto install # Alternatively, you could execute: -# % python buildbot_service.py install +# % buildbot_windows_service install # to install the service with default options, then use Control Panel # to configure it. # # * Start the service specifying the name of all buildbot directories as # service args. This can be done one of 2 ways: # - Execute the command: -# % python buildbot_service.py start "dir_name1" "dir_name2" +# % buildbot_windows_service start "dir_name1" "dir_name2" # or: # - Start Control Panel->Administrative Tools->Services # - Locate the previously installed buildbot service. @@ -46,7 +46,7 @@ # * If you change the buildbot configuration, you must restart the service. # There is currently no way to ask a running buildbot to reload the # config. You can restart by executing: -# % python buildbot_service.py restart +# % buildbot_windows_service restart # # Troubleshooting: # * Check the Windows event log for any errors. diff --git a/master/contrib/windows/buildbot.bat b/master/contrib/windows/buildbot.bat deleted file mode 100644 index b045bc8de37..00000000000 --- a/master/contrib/windows/buildbot.bat +++ /dev/null @@ -1,22 +0,0 @@ -@echo off -REM This file is used to run buildbot when installed into a python installation or deployed in virtualenv - -setlocal -set BB_BUILDBOT="%~dp0buildbot" - -IF EXIST "%~dp0..\python.exe" ( - REM Normal system install of python (buildbot.bat is in scripts dir, just below python.exe) - set BB_PYTHON="%~dp0..\python" -) ELSE IF EXIST "%~dp0python.exe" ( - REM virtualenv install (buildbot.bat is in same dir as python.exe) - set BB_PYTHON="%~dp0python" -) ELSE ( - REM Not found nearby. Use system version and hope for the best - echo Warning! Unable to find python.exe near buildbot.bat. Using python on PATH, which might be a mismatch. - echo. - set BB_PYTHON=python -) - -%BB_PYTHON% %BB_BUILDBOT% %* - -exit /b %ERRORLEVEL% \ No newline at end of file diff --git a/master/setup.py b/master/setup.py index 14cffba842f..e96cb5b7b47 100755 --- a/master/setup.py +++ b/master/setup.py @@ -103,6 +103,13 @@ def define_plugin_entry(name, module_name): return '%s = %s:%s' % (entry, module_name, name) +def concat_dicts(*dicts): + result = dict() + for d in dicts: + result.update(d) + return result + + def define_plugin_entries(groups): """ helper to all groups for plugins @@ -122,13 +129,6 @@ def define_plugin_entries(groups): with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as long_d_f: long_description = long_d_f.read() -scripts = ["bin/buildbot"] -# sdist is usually run on a non-Windows platform, but the buildslave.bat file -# still needs to get packaged. -if 'sdist' in sys.argv or sys.platform == 'win32': - scripts.append("contrib/windows/buildbot.bat") - scripts.append("contrib/windows/buildbot_service.py") - setup_args = { 'name': "buildbot", 'version': version, @@ -207,10 +207,9 @@ def define_plugin_entries(groups): include("buildbot/spec", "*.raml"), include("buildbot/spec/types", "*.raml"), ] + include_statics("buildbot/www/static"), - 'scripts': scripts, 'cmdclass': {'install_data': install_data_twisted, 'sdist': our_sdist}, - 'entry_points': define_plugin_entries([ + 'entry_points': concat_dicts(define_plugin_entries([ ('buildbot.changes', [ ('buildbot.changes.mail', [ 'MaildirSource', 'CVSMaildirSource', @@ -373,7 +372,13 @@ def define_plugin_entries(groups): 'AnyEndpointMatcher', 'StopBuildEndpointMatcher', 'ForceBuildEndpointMatcher', 'RebuildBuildEndpointMatcher']), ]) - ]) + ]), { + 'console_scripts': [ + 'buildbot=buildbot.scripts.runner:run', + # this will also be shipped on non windows :-( + 'buildbot_windows_service=buildbot.scripts.windows_service:HandleCommandLine', + ]} + ) } # set zip_safe to false to force Windows installs to always unpack eggs diff --git a/worker/bin/buildbot-worker b/worker/bin/buildbot-worker deleted file mode 100755 index 10dfde4c3ae..00000000000 --- a/worker/bin/buildbot-worker +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env python - -from buildbot_worker.scripts import runner -runner.run() diff --git a/worker/contrib/windows/buildbot_service.py b/worker/buildbot_worker/scripts/windows_service.py similarity index 98% rename from worker/contrib/windows/buildbot_service.py rename to worker/buildbot_worker/scripts/windows_service.py index 98e1d1b9d62..f3f7956d6d5 100755 --- a/worker/contrib/windows/buildbot_service.py +++ b/worker/buildbot_worker/scripts/windows_service.py @@ -9,23 +9,23 @@ # is working as expected. # # * Install the buildbot service. Execute the command: -# % python buildbot_service.py +# % buildbot_worker_windows_service # To see installation options. You probably want to specify: # + --username and --password options to specify the user to run the # + --startup auto to have the service start at boot time. # # For example: -# % python buildbot_service.py --user mark --password secret \ +# % buildbot_worker_windows_service --user mark --password secret \ # --startup auto install # Alternatively, you could execute: -# % python buildbot_service.py install +# % buildbot_worker_windows_service install # to install the service with default options, then use Control Panel # to configure it. # # * Start the service specifying the name of all buildbot directories as # service args. This can be done one of 2 ways: # - Execute the command: -# % python buildbot_service.py start "dir_name1" "dir_name2" +# % buildbot_worker_windows_service start "dir_name1" "dir_name2" # or: # - Start Control Panel->Administrative Tools->Services # - Locate the previously installed buildbot service. @@ -46,14 +46,14 @@ # * If you change the buildbot configuration, you must restart the service. # There is currently no way to ask a running buildbot to reload the # config. You can restart by executing: -# % python buildbot_service.py restart +# % buildbot_worker_windows_service restart # # Troubleshooting: # * Check the Windows event log for any errors. # * Check the "twistd.log" file in your buildbot directories - once each # bot has been started it just writes to this log as normal. # * Try executing: -# % python buildbot_service.py debug +# % buildbot_windows_service debug # This will execute the buildbot service in "debug" mode, and allow you to # see all messages etc generated. If the service works in debug mode but # not as a real service, the error probably relates to the environment or @@ -522,7 +522,7 @@ def _WaitForShutdown(h): def DetermineRunner(bbdir): - '''Checks if the given directory is a buildbot worker or a master and + '''Checks if the given directory is a buildbot worker or a master and returns the appropriate run function.''' try: import buildbot_worker.scripts.runner diff --git a/worker/contrib/windows/buildbot-worker.bat b/worker/contrib/windows/buildbot-worker.bat deleted file mode 100644 index 99ee908e1cd..00000000000 --- a/worker/contrib/windows/buildbot-worker.bat +++ /dev/null @@ -1,22 +0,0 @@ -@echo off -REM This file is used to run Buildbot Worker when installed into a python installation or deployed in virtualenv - -setlocal -set BB_WORKER="%~dp0buildbot-worker" - -IF EXIST "%~dp0..\python.exe" ( - REM Normal system install of python (buildbot_worker.bat is in scripts dir, just below python.exe) - set BB_PYTHON="%~dp0..\python" -) ELSE IF EXIST "%~dp0python.exe" ( - REM virtualenv install (buildbot_worker.bat is in same dir as python.exe) - set BB_PYTHON="%~dp0python" -) ELSE ( - REM Not found nearby. Use system version and hope for the best - echo Warning! Unable to find python.exe near buildbot_worker.bat. Using python on PATH, which might be a mismatch. - echo. - set BB_PYTHON=python -) - -%BB_PYTHON% %BB_WORKER% %* - -exit /b %ERRORLEVEL% diff --git a/worker/setup.py b/worker/setup.py index a42fb0572c0..14a427f2b4e 100755 --- a/worker/setup.py +++ b/worker/setup.py @@ -27,13 +27,6 @@ from buildbot_worker import version -scripts = ["bin/buildbot-worker"] -# sdist is usually run on a non-Windows platform, but the buildbot-worker.bat -# file still needs to get packaged. -if 'sdist' in sys.argv or sys.platform == 'win32': - scripts.append("contrib/windows/buildbot-worker.bat") - scripts.append("contrib/windows/buildbot_service.py") - class our_install_data(install_data): @@ -97,14 +90,19 @@ def make_release_tree(self, base_dir, files): "buildbot_worker.test.util", "buildbot_worker.test.unit", ], - 'scripts': scripts, # mention data_files, even if empty, so install_data is called and # VERSION gets copied 'data_files': [("buildbot_worker", [])], 'cmdclass': { 'install_data': our_install_data, 'sdist': our_sdist - } + }, + 'entry_points': { + 'console_scripts': [ + 'buildbot_worker=buildbot_worker.scripts.runner:run', + # this will also be shipped on non windows :-( + 'buildbot_worker_windows_service=buildbot_worker.scripts.windows_service:HandleCommandLine', + ]} } # set zip_safe to false to force Windows installs to always unpack eggs