Skip to content

Commit e4977ae

Browse files
authored
DISPATCH-2035 Reduce number of configure_file calls in CMake build (#1225)
This is possible thanks to supporting only Python 3 now.
1 parent e69576d commit e4977ae

11 files changed

+35
-85
lines changed

.gitignore

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ install
77
.pydevproject
88
tests/system_test.dir/
99
tests/policy-1/policy-*.json
10-
tests/authservice.py
11-
tests/failoverserver.py
12-
tests/system_tests_authz_service_plugin.py
13-
tests/system_tests_handle_failover.py
14-
tests/system_tests_topology_disposition.py
1510
tests/system_tests_http.py
1611
python/qpid_dispatch_internal/management/agent.py
1712
*.iml
@@ -21,8 +16,6 @@ python/qpid_dispatch_internal/management/agent.py
2116
.history/
2217
.tox
2318
.vscode
24-
tools/qdmanage
25-
tools/qdstat
2619
console/react/node_modules/
2720
console/react/build/
2821
console/react/coverage/

CMakeLists.txt

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,6 @@ if (LIBWEBSOCKETS_FOUND AND LIBWEBSOCKETS_VERSION_STRING)
142142

143143
endif(LIBWEBSOCKETS_FOUND AND LIBWEBSOCKETS_VERSION_STRING)
144144

145-
# Python
146-
if (Python_VERSION_MAJOR STREQUAL 3)
147-
set(PY_STRING "python3")
148-
elseif(Python_VERSION_MAJOR STREQUAL 2)
149-
set(PY_STRING "python")
150-
endif()
151-
152145
if (NOT DEFINED DISPATCH_TEST_TIMEOUT)
153146
set(DISPATCH_TEST_TIMEOUT "600")
154147
endif (NOT DEFINED DISPATCH_TEST_TIMEOUT)
@@ -264,9 +257,6 @@ install(FILES include/qpid/dispatch.h DESTINATION ${INCLUDE_INSTALL_DIR}/qpid)
264257
install(FILES etc/qdrouterd.conf DESTINATION ${SYSCONF_INSTALL_DIR}/qpid-dispatch)
265258
install(FILES etc/sasl2/qdrouterd.conf DESTINATION ${SYSCONF_INSTALL_DIR}/sasl2)
266259

267-
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tools/qdstat.in ${CMAKE_CURRENT_SOURCE_DIR}/tools/qdstat)
268-
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tools/qdmanage.in ${CMAKE_CURRENT_SOURCE_DIR}/tools/qdmanage)
269-
270260

271261
# Tools
272262
install(PROGRAMS
@@ -285,12 +275,7 @@ add_subdirectory(src) # Build src first so other subdirs can use QPID_DISPATCH_L
285275
# run.py environment runner script - needs QPID_DISPATCH_LIB
286276
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/run.py.in ${CMAKE_CURRENT_BINARY_DIR}/run.py)
287277
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/run.py.in ${CMAKE_CURRENT_BINARY_DIR}/tests/run.py)
288-
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tests/authservice.py.in ${CMAKE_CURRENT_SOURCE_DIR}/tests/authservice.py)
289-
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tests/failoverserver.py.in ${CMAKE_CURRENT_SOURCE_DIR}/tests/failoverserver.py)
290-
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tests/system_tests_authz_service_plugin.py.in ${CMAKE_CURRENT_SOURCE_DIR}/tests/system_tests_authz_service_plugin.py)
291-
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tests/system_tests_handle_failover.py.in ${CMAKE_CURRENT_SOURCE_DIR}/tests/system_tests_handle_failover.py)
292278
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tests/system_tests_http.py.in ${CMAKE_CURRENT_SOURCE_DIR}/tests/system_tests_http.py)
293-
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tests/system_tests_topology_disposition.py.in ${CMAKE_CURRENT_SOURCE_DIR}/tests/system_tests_topology_disposition.py)
294279
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/python/qpid_dispatch_internal/management/agent.py.in ${CMAKE_CURRENT_SOURCE_DIR}/python/qpid_dispatch_internal/management/agent.py)
295280
execute_process(COMMAND ${RUN} --sh OUTPUT_FILE config.sh)
296281

python/setup.py.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env ${PY_STRING}
1+
#!/usr/bin/env python3
22
#
33
# Licensed to the Apache Software Foundation (ASF) under one
44
# or more contributor license agreements. See the NOTICE file

run.py.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env ${PY_STRING}
1+
#!/usr/bin/env python3
22
##
33
# Licensed to the Apache Software Foundation (ASF) under one
44
# or more contributor license agreements. See the NOTICE file

tests/authservice.py.in renamed to tests/authservice.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env ${PY_STRING}
1+
#!/usr/bin/env python3
22
#
33
# Licensed to the Apache Software Foundation (ASF) under one
44
# or more contributor license agreements. See the NOTICE file
@@ -18,18 +18,14 @@
1818
# under the License.
1919
#
2020

21-
from __future__ import unicode_literals
22-
from __future__ import division
23-
from __future__ import absolute_import
24-
from __future__ import print_function
25-
26-
import sys
27-
import signal
2821
import optparse
22+
import signal
23+
import sys
24+
25+
from cproton import pn_sasl_config_path
26+
from proton import Array, Data, symbol, UNDESCRIBED
2927
from proton.handlers import MessagingHandler
3028
from proton.reactor import Container
31-
from proton import Array, Data, symbol, UNDESCRIBED
32-
from cproton import pn_sasl_config_path
3329

3430

3531
class AuthService(MessagingHandler):

tests/failoverserver.py.in renamed to tests/failoverserver.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env ${PY_STRING}
1+
#!/usr/bin/env python3
22
#
33
# Licensed to the Apache Software Foundation (ASF) under one
44
# or more contributor license agreements. See the NOTICE file
@@ -18,18 +18,13 @@
1818
# under the License.
1919
#
2020

21-
22-
from __future__ import unicode_literals
23-
from __future__ import division
24-
from __future__ import absolute_import
25-
from __future__ import print_function
26-
27-
import signal
2821
import optparse
22+
import signal
2923
import sys
24+
25+
from proton import symbol
3026
from proton.handlers import MessagingHandler
3127
from proton.reactor import Container
32-
from proton import symbol
3328

3429

3530
class FailoverServer(MessagingHandler):

tests/system_tests_authz_service_plugin.py.in renamed to tests/system_tests_authz_service_plugin.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,17 @@
1717
# under the License.
1818
#
1919

20-
from __future__ import unicode_literals
21-
from __future__ import division
22-
from __future__ import absolute_import
23-
from __future__ import print_function
24-
2520
import os
21+
import sys
2622
from subprocess import PIPE, Popen
27-
from system_test import TestCase, Qdrouterd, main_module, DIR, Process, SkipIfNeeded
28-
from system_test import unittest
23+
2924
from proton import Message, SASL
3025
from proton.handlers import MessagingHandler
3126
from proton.reactor import Container
3227

28+
from system_test import TestCase, Qdrouterd, main_module, DIR, Process, SkipIfNeeded
29+
from system_test import unittest
30+
3331

3432
class AuthServicePluginAuthzTest(TestCase):
3533
@classmethod
@@ -70,7 +68,7 @@ def setUpClass(cls):
7068
cls.createSaslFiles()
7169

7270
cls.auth_service_port = cls.tester.get_port()
73-
cls.tester.popen(['/usr/bin/env', '${PY_STRING}', os.path.join(os.path.dirname(os.path.abspath(__file__)), 'authservice.py'),
71+
cls.tester.popen([sys.executable, os.path.join(os.path.dirname(os.path.abspath(__file__)), 'authservice.py'),
7472
'-a', 'amqps://127.0.0.1:%d' % cls.auth_service_port, '-c', os.getcwd()], expect=Process.RUNNING)
7573

7674
policy_config_path = os.path.join(DIR, 'policy-authz')
@@ -155,7 +153,7 @@ def setUpClass(cls):
155153
cls.createSaslFiles()
156154

157155
cls.auth_service_port = cls.tester.get_port()
158-
cls.tester.popen(['/usr/bin/env', '${PY_STRING}', os.path.join(os.path.dirname(os.path.abspath(__file__)), 'authservice.py'),
156+
cls.tester.popen([sys.executable, os.path.join(os.path.dirname(os.path.abspath(__file__)), 'authservice.py'),
159157
'-a', 'amqps://127.0.0.1:%d' % cls.auth_service_port, '-c', os.getcwd()], expect=Process.RUNNING)
160158

161159
cls.router_port = cls.tester.get_port()

tests/system_tests_handle_failover.py.in renamed to tests/system_tests_handle_failover.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,16 @@
1717
# under the License.
1818
#
1919

20-
from __future__ import unicode_literals
21-
from __future__ import division
22-
from __future__ import absolute_import
23-
from __future__ import print_function
24-
25-
import os
26-
from threading import Timer
2720
import json
21+
import os
2822
import re
29-
from system_test import main_module, TIMEOUT
23+
import sys
24+
from subprocess import PIPE, STDOUT
25+
from threading import Timer
26+
3027
from system_test import TestCase, Qdrouterd, Process, TIMEOUT
28+
from system_test import main_module
3129
from system_test import unittest
32-
from subprocess import PIPE, STDOUT
3330

3431

3532
class FailoverTest(TestCase):
@@ -288,7 +285,7 @@ def test_4_remove_router_B_connect_to_my_server(self):
288285

289286
# Start MyServer
290287
proc = FailoverTest.tester.popen(
291-
['/usr/bin/env', '${PY_STRING}', os.path.join(os.path.dirname(os.path.abspath(__file__)), 'failoverserver.py'), '-a',
288+
[sys.executable, os.path.join(os.path.dirname(os.path.abspath(__file__)), 'failoverserver.py'), '-a',
292289
'amqp://127.0.0.1:%d' % FailoverTest.my_server_port], expect=Process.RUNNING)
293290

294291
# Kill the router B again

tests/system_tests_topology_disposition.py.in renamed to tests/system_tests_topology_disposition.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,18 @@
1717
# under the License.
1818
#
1919

20-
from __future__ import unicode_literals
21-
from __future__ import division
22-
from __future__ import absolute_import
23-
from __future__ import print_function
24-
25-
import unittest
2620
import os
21+
import sys
22+
import time
23+
import unittest
2724
from subprocess import PIPE, STDOUT
25+
2826
from proton import Message, Timeout
29-
from system_test import TestCase, Qdrouterd, main_module
3027
from proton.handlers import MessagingHandler
3128
from proton.reactor import Container
3229
from qpid_dispatch_internal.compat import UNICODE
3330

34-
import time
35-
import sys
31+
from system_test import TestCase, Qdrouterd, main_module
3632

3733

3834
# ================================================
@@ -422,7 +418,7 @@ def test_04_scraper_tool(self):
422418
files = []
423419
for router in [self.router_A, self.router_B, self.router_C, self.router_D]:
424420
files.append(router.logfile_path)
425-
p = self.popen(['/usr/bin/env', '${PY_STRING}', scraper_path, '-f'] + files,
421+
p = self.popen([sys.executable, scraper_path, '-f'] + files,
426422
stdin=PIPE, stdout=PIPE, stderr=STDOUT,
427423
universal_newlines=True)
428424
out = p.communicate(None)[0]
@@ -438,7 +434,7 @@ def test_04_scraper_tool(self):
438434
self.assertIn('</body>', out)
439435

440436
# split A.log
441-
p = self.popen(['/usr/bin/env', '${PY_STRING}', scraper_path, '--split', '-f', self.router_A.logfile_path],
437+
p = self.popen([sys.executable, scraper_path, '--split', '-f', self.router_A.logfile_path],
442438
stdin=PIPE, stdout=PIPE, stderr=STDOUT,
443439
universal_newlines=True)
444440
out = p.communicate(None)[0]

tools/qdmanage.in renamed to tools/qdmanage

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env ${PY_STRING}
1+
#!/usr/bin/env python3
22

33
#
44
# Licensed to the Apache Software Foundation (ASF) undeugr one
@@ -19,11 +19,6 @@
1919
# under the License.
2020
#
2121

22-
from __future__ import unicode_literals
23-
from __future__ import division
24-
from __future__ import absolute_import
25-
from __future__ import print_function
26-
2722
import sys
2823
import json
2924
import re

tools/qdstat.in renamed to tools/qdstat

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env ${PY_STRING}
1+
#!/usr/bin/env python3
22

33
#
44
# Licensed to the Apache Software Foundation (ASF) under one
@@ -19,11 +19,6 @@
1919
# under the License.
2020
#
2121

22-
from __future__ import unicode_literals
23-
from __future__ import division
24-
from __future__ import absolute_import
25-
from __future__ import print_function
26-
2722
import sys
2823
from datetime import datetime
2924
from time import ctime, strftime, gmtime

0 commit comments

Comments
 (0)