1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099
|
Description: Additional porting to python3
Author: Alastair McKinstry <mckinstry@debian.org>
Last-Updated: 2019-09-27
Forwarded: no
Index: vistrails-3.0~git+9dc22bd/scripts/sql_delete.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/sql_delete.py
+++ vistrails-3.0~git+9dc22bd/scripts/sql_delete.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
@@ -38,13 +38,13 @@ import sys
if '/vistrails/src/trunk/vistrails' not in sys.path:
sys.path.append('/vistrails/src/trunk/vistrails')
import vistrails.db.services.io
-import urlparse
+import urllib.parse
import getpass
def run(url, type, id):
scheme, rest = url.split('://', 1)
url = 'http://' + rest
- (_, net_loc, db_name, args_str, _) = urlparse.urlsplit(url)
+ (_, net_loc, db_name, args_str, _) = urllib.parse.urlsplit(url)
db_name = db_name[1:]
net_loc_arr = net_loc.split('@',1)
if len(net_loc_arr) > 1:
@@ -62,7 +62,7 @@ def run(url, type, id):
config = {'host': host, 'port': int(port),
'user': user, 'db': db_name}
- print config
+ print (config)
try:
conn = vistrails.db.services.io.open_db_connection(config)
except Exception:
@@ -74,9 +74,9 @@ def run(url, type, id):
if __name__ == '__main__':
if len(sys.argv) < 4:
- print "Usage: %s %s <db_connection_str> <type> <id>" % \
- (sys.executable, sys.argv[0])
- print " <db_connection_str> := [<user>@]<host>[:<port>]/<db>"
- print " Password prompt displayed if required"
+ print(("Usage: %s %s <db_connection_str> <type> <id>" % \
+ (sys.executable, sys.argv[0])))
+ print (" <db_connection_str> := [<user>@]<host>[:<port>]/<db>")
+ print (" Password prompt displayed if required")
sys.exit(61)
run(*sys.argv[1:])
Index: vistrails-3.0~git+9dc22bd/scripts/sql_to_xml.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/sql_to_xml.py
+++ vistrails-3.0~git+9dc22bd/scripts/sql_to_xml.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
@@ -50,8 +50,8 @@ def convert_sql_to_xml(filename, id):
vistrail = io.open_vistrail_from_db(db_connection, id)
io.save_vistrail_to_xml(vistrail, filename)
io.close_db_connection(db_connection)
- except MySQLdb.Error, e:
- print e
+ except MySQLdb.Error as e:
+ print(e)
if __name__ == '__main__':
convert_sql_to_xml('/tmp/vt_from_db.xml', 4)
Index: vistrails-3.0~git+9dc22bd/scripts/system_info.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/system_info.py
+++ vistrails-3.0~git+9dc22bd/scripts/system_info.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
@@ -39,49 +39,49 @@
import sys
import platform
-print "Python:"
-print " Basic version: %s.%s.%s" % (sys.version_info[0],
+print("Python:")
+print(" Basic version: %s.%s.%s" % (sys.version_info[0],
sys.version_info[1],
- sys.version_info[2], )
-print " Full version: " + sys.version.replace('\n', ' ')
-print
+ sys.version_info[2], ))
+print(" Full version: " + sys.version.replace('\n', ' '))
+print()
def c(s):
return s or "<COULD NOT DETERMINE>"
-print "System:"
-print " Type: " + c(platform.system())
-print " Architecture: " + c(platform.architecture()[0])
-print " Machine: " + c(platform.machine())
-print " Platform: " + c(platform.platform())
-print " Processor: " + c(platform.processor())
-print
+print("System:")
+print(" Type: " + c(platform.system()))
+print(" Architecture: " + c(platform.architecture()[0]))
+print(" Machine: " + c(platform.machine()))
+print(" Platform: " + c(platform.platform()))
+print(" Processor: " + c(platform.processor()))
+print()
##############################################################################
-print "Libraries:"
+print("Libraries:")
try:
import sip
- print " sip installed."
- print " version: " + sip.SIP_VERSION_STR
+ print(" sip installed.")
+ print(" version: " + sip.SIP_VERSION_STR)
except ImportError:
- print " sip NOT installed."
-print
+ print(" sip NOT installed.")
+print()
try:
import PyQt4.Qt
- print " PyQt installed."
- print " Qt version: " + PyQt4.Qt.QT_VERSION_STR
- print " PyQt version: " + PyQt4.Qt.PYQT_VERSION_STR
+ print(" PyQt installed.")
+ print(" Qt version: " + PyQt4.Qt.QT_VERSION_STR)
+ print(" PyQt version: " + PyQt4.Qt.PYQT_VERSION_STR)
except ImportError:
- print " PyQt NOT installed."
-print
+ print(" PyQt NOT installed.")
+print()
try:
import vtk
- print " VTK installed."
- print " VTK short version: " + vtk.vtkVersion().GetVTKVersion()
- print " VTK full version: " + vtk.vtkVersion().GetVTKSourceVersion()
+ print(" VTK installed.")
+ print(" VTK short version: " + vtk.vtkVersion().GetVTKVersion())
+ print(" VTK full version: " + vtk.vtkVersion().GetVTKSourceVersion())
except ImportError:
- print " VTK NOT installed."
+ print(" VTK NOT installed.")
Index: vistrails-3.0~git+9dc22bd/scripts/update_copyright_year.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/update_copyright_year.py
+++ vistrails-3.0~git+9dc22bd/scripts/update_copyright_year.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
@@ -39,7 +39,7 @@
year with 2008 in the file header.
"""
-from itertools import izip
+
import os
import re
@@ -65,15 +65,15 @@ for (path, dnames, fnames) in os.walk('.
files.append(os.path.join(path, fn))
# Go through files and update them
-print "%d files found" % len(files)
+print("%d files found" % len(files))
count = 0
for fname in files:
fp = open(fname, 'rb')
try:
# Search only in the first few lines
- for line_num, line in izip(xrange(NB_SEARCHED_LINES), fp):
+ for line_num, line in zip(range(NB_SEARCHED_LINES), fp):
if RE_COPYRIGHT.search(line):
- print "Updating %s" % fname
+ print("Updating %s" % fname)
fp.seek(0)
lines = fp.readlines()
fp.close()
@@ -84,4 +84,4 @@ for fname in files:
break
finally:
fp.close()
-print "%d files updated" % count
+print("%d files updated" % count)
Index: vistrails-3.0~git+9dc22bd/scripts/update_db.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/update_db.py
+++ vistrails-3.0~git+9dc22bd/scripts/update_db.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
@@ -55,7 +55,7 @@ def update_db(config, new_version=None,
new_version = currentVersion
if tmp_dir is None:
tmp_dir = tempfile.mkdtemp(prefix='vt_db')
- print 'creating tmpdir:', tmp_dir
+ print('creating tmpdir:', tmp_dir)
db_connection = io.open_db_connection(config)
obj_id_lists = {}
@@ -72,12 +72,12 @@ def update_db(config, new_version=None,
# read data out of database
thumbnail_dir = os.path.join(tmp_dir, 'thumbs')
os.mkdir(thumbnail_dir)
- for obj_type, obj_ids in obj_id_lists.iteritems():
+ for obj_type, obj_ids in obj_id_lists.items():
for (obj_id, _, _) in obj_ids:
old_version = io.get_db_object_version(db_connection, obj_id,
'vistrail')
- print 'getting', obj_type, 'id', obj_id
+ print('getting', obj_type, 'id', obj_id)
local_tmp_dir = os.path.join(tmp_dir, str(obj_id))
vt_name = os.path.join(tmp_dir, str(obj_id) + '.vt')
try:
@@ -87,7 +87,7 @@ def update_db(config, new_version=None,
os.mkdir(local_tmp_dir)
except:
import traceback
- print "Could not read:", traceback.format_exc()
+ print("Could not read:", traceback.format_exc())
continue
io.save_vistrail_bundle_to_zip_xml(res, vt_name, local_tmp_dir)
@@ -100,9 +100,9 @@ def update_db(config, new_version=None,
(res, _) = io.open_vistrail_bundle_from_zip_xml(filename)
try:
io.save_vistrail_bundle_to_db(res, db_connection, 'with_ids')
- except Exception, e:
+ except Exception as e:
import traceback
- print filename, e, traceback.format_exc()
+ print(filename, e, traceback.format_exc())
io.close_db_connection(db_connection)
if __name__ == '__main__':
Index: vistrails-3.0~git+9dc22bd/scripts/update_email_contact.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/update_email_contact.py
+++ vistrails-3.0~git+9dc22bd/scripts/update_email_contact.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
@@ -55,7 +55,7 @@ for (path, dnames, fnames) in os.walk('.
files.append(os.path.join(path, fn))
break
-print len(files), " files will be processed."
+print(len(files), " files will be processed.")
count = 0
for fname in files:
@@ -64,10 +64,10 @@ for fname in files:
fin.close()
pos = all_lines.find(OLD_EMAIL)
if pos > -1:
- print "Updating: %s"%fname
+ print("Updating: %s"%fname)
newlines = all_lines.replace(OLD_EMAIL, NEW_EMAIL)
fout = file(fname, 'w')
fout.write(newlines)
fout.close()
count += 1
-print count, " files updated "
+print(count, " files updated ")
Index: vistrails-3.0~git+9dc22bd/scripts/update_to_mod_bsd_license.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/update_to_mod_bsd_license.py
+++ vistrails-3.0~git+9dc22bd/scripts/update_to_mod_bsd_license.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
@@ -237,7 +237,7 @@ def process_files(files, old_license, ne
pos = all_lines.find(old_license)
pos_gen = all_lines.find("GNU General Public")
if pos > -1:
- print "Updating: %s"%fname
+ print("Updating: %s"%fname)
newlines = all_lines.replace(old_license, new_license)
fout = file(fname, 'w')
fout.write(newlines)
@@ -248,16 +248,16 @@ def process_files(files, old_license, ne
gpl_found.append(fname)
else:
if all_lines.find(new_license) == -1:
- print "Appending license to %s"%fname
+ print("Appending license to %s"%fname)
newlines = new_license+"\n"+all_lines
fout = file(fname, 'w')
fout.write(newlines)
fout.close()
count +=1
- print count, " %s files updated"%type
- print " found reference to gpl in the following files:"
+ print(count, " %s files updated"%type)
+ print(" found reference to gpl in the following files:")
for fname in gpl_found:
- print " ", fname
+ print(" ", fname)
py_files = []
xml_files = []
@@ -277,16 +277,16 @@ for (path, dnames, fnames) in os.walk('.
else:
others.append(os.path.join(path,fn))
-print len(py_files), " python files found"
+print(len(py_files), " python files found")
process_files(py_files, py_old_license, py_bsd_3_license, 'python')
-print len(sql_files), " sql files found"
+print(len(sql_files), " sql files found")
process_files(sql_files, sql_old_license, sql_bsd_3_license, 'sql')
-print len(xml_files), " xml files found"
+print(len(xml_files), " xml files found")
process_files(xml_files, xml_old_license, xml_bsd_3_license, 'xml')
-print len(php_files), " php files found"
+print(len(php_files), " php files found")
process_files(php_files, php_old_license, php_bsd_3_license, 'php')
#print "Ignored files: "
Index: vistrails-3.0~git+9dc22bd/scripts/watch_vistrail_servers.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/watch_vistrail_servers.py
+++ vistrails-3.0~git+9dc22bd/scripts/watch_vistrail_servers.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
@@ -34,7 +34,7 @@
## ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
##
###############################################################################
-import xmlrpclib
+import xmlrpc.client
import os
from subprocess import Popen, PIPE
from time import sleep
@@ -73,7 +73,7 @@ class VistrailWatcher(object):
# create proxies
for port in self.ports:
- self.proxies[port] = xmlrpclib.ServerProxy("http://%s:%d" % \
+ self.proxies[port] = xmlrpc.client.ServerProxy("http://%s:%d" % \
(self.server, port))
self.is_down[port] = False
@@ -125,7 +125,7 @@ class VistrailWatcher(object):
try:
Popen(args)
sleep(20)
- except Exception, e:
+ except Exception as e:
self.logger.error("Couldn't start the instance on display:"
"%s port: %s") % (instance_virtual_display, port)
self.logger.error(str(e))
@@ -135,7 +135,7 @@ class VistrailWatcher(object):
if not self.ports:
self.logger.info("no running instances found")
- print "no running instances found"
+ print("no running instances found")
return
self.logger.info("watching %s" % str(self.ports))
@@ -153,7 +153,7 @@ class VistrailWatcher(object):
if self.is_down[port]:
self.logger.info("%s:%d is back up" % (self.server, port))
self.is_down[port] = False
- except Exception, e:
+ except Exception as e:
if not self.is_down[port]:
# first time down, send email
self.send_email("%s:%d is down" % (self.server, port))
Index: vistrails-3.0~git+9dc22bd/scripts/convert_files/fix_file.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/convert_files/fix_file.py
+++ vistrails-3.0~git+9dc22bd/scripts/convert_files/fix_file.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
@@ -40,15 +40,15 @@ import re
re_list = []
if len(sys.argv) < 4:
- print "Usage:"
- print "%s file_to_process path_to_data_files data_file_1 data_file_2 ..." % sys.argv[0]
+ print("Usage:")
+ print("%s file_to_process path_to_data_files data_file_1 data_file_2 ..." % sys.argv[0])
sys.exit(1)
-for i in xrange(3, len(sys.argv)):
+for i in range(3, len(sys.argv)):
re_list.append((sys.argv[i], re.compile(r"val='[^']*" + sys.argv[i] + r"[^']*'")))
f = file(sys.argv[1])
for l in f:
for (s, re_obj) in re_list:
l = re_obj.sub("val='" + sys.argv[2] + s + "'", l)
- print l[:-1]
+ print(l[:-1])
Index: vistrails-3.0~git+9dc22bd/scripts/create_release_wiki_table.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/create_release_wiki_table.py
+++ vistrails-3.0~git+9dc22bd/scripts/create_release_wiki_table.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
@@ -120,7 +120,7 @@ def create_text():
|.pdf
|-
"""%(SF_DOWNLOAD_URL, USERSGUIDE, USERSGUIDE, USERSGUIDE_SIZE)
- print text
+ print(text)
if __name__ == "__main__":
create_text()
Index: vistrails-3.0~git+9dc22bd/scripts/create_server_media_dir_structure.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/create_server_media_dir_structure.py
+++ vistrails-3.0~git+9dc22bd/scripts/create_server_media_dir_structure.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
@@ -69,33 +69,33 @@ if __name__ == "__main__":
if len(args) == 2:
media_dir = args[1]
else:
- print "Usage: %s /path/to/media_dir" % args[0]
+ print("Usage: %s /path/to/media_dir" % args[0])
sys.exit(0)
if os.path.exists(media_dir):
if not os.path.isdir(media_dir):
- print "Error: %s exists and it is not a directory." %media_dir
+ print("Error: %s exists and it is not a directory." %media_dir)
error = True
elif path_exists_and_not_empty(media_dir):
- print "Error: %s exists and it is not empty. "% media_dir
+ print("Error: %s exists and it is not empty. "% media_dir)
error = True
else:
- print "%s does not exist. Trying to create directory..."%media_dir
+ print("%s does not exist. Trying to create directory..."%media_dir)
try:
os.mkdir(media_dir)
- except Exception, e:
- print "Error creating %s directory: %s" % (media_dir, str(e))
+ except Exception as e:
+ print("Error creating %s directory: %s" % (media_dir, str(e)))
error = True
if not error:
- print "Creating inner structure... "
+ print("Creating inner structure... ")
for path_list in folders:
folder = os.path.join(media_dir, os.path.join(*path_list))
- print " ", folder
+ print(" ", folder)
try:
os.makedirs(folder)
- except Exception, e:
- print "Error creating %s directory: %s" % (folder, str(e))
- print "Done."
+ except Exception as e:
+ print("Error creating %s directory: %s" % (folder, str(e)))
+ print("Done.")
else:
- print "There was an error. Please check the messages above. "
+ print("There was an error. Please check the messages above. ")
sys.exit(1)
Index: vistrails-3.0~git+9dc22bd/scripts/db_utils.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/db_utils.py
+++ vistrails-3.0~git+9dc22bd/scripts/db_utils.py
@@ -1,3 +1,4 @@
+#!/usr/bin/python3
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
@@ -43,7 +44,7 @@ def usage(usageDict):
unrequired = ''
required = ''
align_len = 15
- for (opt, info) in usageDict.iteritems():
+ for (opt, info) in usageDict.items():
if info[1]:
required += '-%s <%s> ' % (opt[0], info[2])
usageStr += ' -%s <%s> %s' % (opt[0], info[2],
@@ -59,11 +60,11 @@ def usage(usageDict):
unrequired += '[-%s] ' % opt[0]
usageStr += ' -%s %s' % (opt[0], ' ' * align_len)
usageStr += '%s\n' % info[0]
- print 'Usage: %s %s %s%s\n%s' % (sys.executable,
+ print('Usage: %s %s %s%s\n%s' % (sys.executable,
sys.argv[0],
required,
unrequired,
- usageStr)
+ usageStr))
def parse_db_cmd_line(argv, more_options={}):
options = {}
@@ -74,9 +75,9 @@ def parse_db_cmd_line(argv, more_options
}
optionsUsage.update(more_options)
- optStr = ''.join(optionsUsage.keys())
+ optStr = ''.join(list(optionsUsage.keys()))
optKeys = optStr.replace(':','')
- for idx in xrange(len(optKeys)):
+ for idx in range(len(optKeys)):
options[optKeys[idx]] = False
try:
@@ -90,7 +91,7 @@ def parse_db_cmd_line(argv, more_options
usage(optionsUsage)
sys.exit(23)
- for opt, spec in optionsUsage.iteritems():
+ for opt, spec in optionsUsage.items():
if spec[1] and not options[opt[0]]:
usage(optionsUsage)
sys.exit(23)
Index: vistrails-3.0~git+9dc22bd/scripts/diff_package.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/diff_package.py
+++ vistrails-3.0~git+9dc22bd/scripts/diff_package.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
@@ -72,32 +72,32 @@ def diff_package(pkg_id, reg_fname1, reg
for ps in d2.port_specs_list:
d2_port_specs[(ps.name, ps.type)] = ps.sigstring
d2_port_specs_set = set(d2_port_specs.keys())
- for ps_id, sig1 in d1_port_specs.iteritems():
+ for ps_id, sig1 in d1_port_specs.items():
if ps_id not in d2_port_specs:
- print "added %s port: %s:%s" % \
- (ps_id[1], get_module_name(d1), ps_id[0])
+ print("added %s port: %s:%s" % \
+ (ps_id[1], get_module_name(d1), ps_id[0]))
continue
d2_port_specs_set.discard(ps_id)
if sig1 != d2_port_specs[ps_id]:
- print "changed %s port: %s:%s" % \
- (ps_id[1], get_module_name(d1), ps_id[0])
- print " %s -> %s" % (sig1, d2_port_specs[ps_id])
+ print("changed %s port: %s:%s" % \
+ (ps_id[1], get_module_name(d1), ps_id[0]))
+ print(" %s -> %s" % (sig1, d2_port_specs[ps_id]))
else:
# equal
pass
for ps_id in d2_port_specs_set:
- print "deleted %s port: %s:%s" % \
- (ps_id[1], get_module_name(d1), ps_id[0])
+ print("deleted %s port: %s:%s" % \
+ (ps_id[1], get_module_name(d1), ps_id[0]))
del d2_modules_dict[(d1.identifier, d1.name, d1.namespace)]
else:
- print "deleted module: %s" % get_module_name(d1)
- for d2 in d2_modules_dict.itervalues():
- print "added module: %s" % get_module_name(d2)
+ print("deleted module: %s" % get_module_name(d1))
+ for d2 in d2_modules_dict.values():
+ print("added module: %s" % get_module_name(d2))
if __name__ == '__main__':
if len(sys.argv) < 4:
- print "Usage: %s %s <pkg_identifer> <old_registry> <new_registry>" % \
- (sys.executable, sys.argv[0])
+ print("Usage: %s %s <pkg_identifer> <old_registry> <new_registry>" % \
+ (sys.executable, sys.argv[0]))
sys.exit(71)
vistrails.core.application.init()
diff_package(*sys.argv[1:])
Index: vistrails-3.0~git+9dc22bd/scripts/dist/common/prepare_release.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/dist/common/prepare_release.py
+++ vistrails-3.0~git+9dc22bd/scripts/dist/common/prepare_release.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
# Updates the binary changelogs, version numbers, hash, and branch from CHANGELOG
# First updates hash in changelog if git is available
# Run and commit changes to git before building release
@@ -59,7 +59,7 @@ def update_value(fname, pre, value):
if m is not None:
lines[i] = rexp.sub(value, line)
if line != lines[i]:
- print '%s:\n' % fname, line, lines[i],
+ print('%s:\n' % fname, line, lines[i], end=' ')
replaced = True
break
i += 1
@@ -123,4 +123,4 @@ if __name__ == '__main__':
'-w', '546',
'scripts/dist/common/splash/splash.svg'])
except (OSError, subprocess.CalledProcessError):
- print "Calling inkscape failed, skipping splash screen update!"
+ print("Calling inkscape failed, skipping splash screen update!")
Index: vistrails-3.0~git+9dc22bd/scripts/dist/mac/fix_itk_libraries.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/dist/mac/fix_itk_libraries.py
+++ vistrails-3.0~git+9dc22bd/scripts/dist/mac/fix_itk_libraries.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
@@ -42,8 +42,8 @@ import os.path
import sys
def usage():
- print "Usage: "
- print " %s path_to_itk_files destination_folder" % sys.argv[0]
+ print("Usage: ")
+ print(" %s path_to_itk_files destination_folder" % sys.argv[0])
sys.exit(1)
try:
@@ -61,7 +61,7 @@ try:
except IndexError:
usage()
-print "This will copy the *.dylib to", destination_libs, " and *.so and the python files to ", destination_python_files
+print("This will copy the *.dylib to", destination_libs, " and *.so and the python files to ", destination_python_files)
libnames = re.compile(r'.*\.dylib')
itklibnames = re.compile(r'(.*emanuele*.*\.dylib) .*')
@@ -80,7 +80,7 @@ def link_or_copy(src, dst):
# Links if possible, but we're across devices, we need to copy.
try:
os.link(src, dst)
- except OSError, e:
+ except OSError as e:
if e.errno == 18:
# Across-device linking is not possible. Let's copy.
shutil.copyfile(src, dst)
@@ -117,15 +117,15 @@ for f in file_names:
so_to_visit.add(f)
if len(files_to_visit) == 0:
- print "looks like you started the script from the wrong directory"
+ print("looks like you started the script from the wrong directory")
sys.exit(1)
while len(files_to_visit):
f = files_to_visit.pop()
- print "Visiting file", f
+ print("Visiting file", f)
src = os.path.join(path_to_libs,f)
dst = os.path.join(destination_libs,f)
- print "Copyng to destination folder..."
+ print("Copyng to destination folder...")
link_or_copy(src,dst)
pout, pin = popen2.popen2("otool -L %s" % dst)
# print pout.readlines()
@@ -146,27 +146,27 @@ while len(files_to_visit):
#print "new file!", f
result = os.system(cmd_line)
if result != 0:
- print "Something went wrong with install_name_tool. Ouch."
+ print("Something went wrong with install_name_tool. Ouch.")
sys.exit(1)
# creating symbolic links
cur_dir = os.getcwd()
os.chdir(destination_libs)
-print "Creating symbolic links in %s " % os.getcwd()
+print("Creating symbolic links in %s " % os.getcwd())
while len(links_to_visit):
f = links_to_visit.pop()
src = os.readlink(os.path.join(path_to_libs,f))
- print " ", f, " -> " , src
+ print(" ", f, " -> " , src)
os.symlink(src,f)
os.chdir(cur_dir)
-print "Dealing with *.so files... "
+print("Dealing with *.so files... ")
while len(so_to_visit):
f = so_to_visit.pop()
- print "Visiting file", f
+ print("Visiting file", f)
src = os.path.join(path_to_libs,f)
dst = os.path.join(destination_python_files,f)
- print "Copyng to destination folder..."
+ print("Copyng to destination folder...")
link_or_copy(src,dst)
pout, pin = popen2.popen2("otool -L %s" % dst)
# print pout.readlines()
@@ -187,20 +187,20 @@ while len(so_to_visit):
#print "new file!", f
result = os.system(cmd_line)
if result != 0:
- print "Something went wrong with install_name_tool. Ouch."
+ print("Something went wrong with install_name_tool. Ouch.")
sys.exit(1)
#copying python files
-print "copying python files... "
+print("copying python files... ")
src = os.path.join(path_to_python_files,'*')
os.system("cp -r %s %s" % (src, destination_python_files))
-print "copying python files in %s..." % path_to_libs
+print("copying python files in %s..." % path_to_libs)
src = os.path.join(path_to_libs,'*.py')
os.system("cp %s %s" % (src, destination_python_files))
-print "copying static libs..."
+print("copying static libs...")
src = os.path.join(path_to_libs, "*.a")
os.system("cp %s %s" % (src, destination_libs))
-print "Done with ITK."
+print("Done with ITK.")
Index: vistrails-3.0~git+9dc22bd/scripts/dist/mac/fix_qtplugin_libs.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/dist/mac/fix_qtplugin_libs.py
+++ vistrails-3.0~git+9dc22bd/scripts/dist/mac/fix_qtplugin_libs.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
@@ -54,8 +54,8 @@ import os.path
import sys
def usage():
- print "Usage: "
- print " %s path_to_dylibs" % sys.argv[0]
+ print("Usage: ")
+ print(" %s path_to_dylibs" % sys.argv[0])
sys.exit(1)
try:
@@ -64,7 +64,7 @@ try:
except IndexError:
usage()
-print "This will modify the *.dylibs in ", path_to_libs
+print("This will modify the *.dylibs in ", path_to_libs)
libnames = re.compile(r'.*\.dylib')
libnames_otool = re.compile(r'(.*\.dylib) (\(.+\))')
@@ -87,7 +87,7 @@ def link_or_copy(src, dst):
# Links if possible, but we're across devices, we need to copy.
try:
os.link(src, dst)
- except OSError, e:
+ except OSError as e:
if e.errno == 18:
# Across-device linking is not possible. Let's copy.
shutil.copyfile(src, dst)
@@ -122,12 +122,12 @@ for f in file_names:
links_to_visit.add(f)
if len(files_to_visit) == 0:
- print "looks like you started the script from the wrong directory"
+ print("looks like you started the script from the wrong directory")
sys.exit(1)
while len(files_to_visit):
f = files_to_visit.pop()
- print "Visiting file", f
+ print("Visiting file", f)
src = os.path.join(path_to_libs,f)
pout, pin = popen2.popen2("otool -L %s" % src)
@@ -143,7 +143,7 @@ while len(files_to_visit):
#print "id_cmd_line ", id_cmd_line
result = os.system(id_cmd_line)
if result != 0:
- print "Something went wrong with install_name_tool. Ouch."
+ print("Something went wrong with install_name_tool. Ouch.")
sys.exit(1)
for l in lines[2:]:
@@ -165,7 +165,7 @@ while len(files_to_visit):
#print "new file!", f
result = os.system(cmd_line)
if result != 0:
- print "Something went wrong with install_name_tool. Ouch."
+ print("Something went wrong with install_name_tool. Ouch.")
sys.exit(1)
# creating symbolic links
@@ -180,4 +180,4 @@ while len(files_to_visit):
#os.chdir(cur_dir)
-print "Done."
+print("Done.")
Index: vistrails-3.0~git+9dc22bd/scripts/dist/source/make-vistrails-src-build.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/dist/source/make-vistrails-src-build.py
+++ vistrails-3.0~git+9dc22bd/scripts/dist/source/make-vistrails-src-build.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
###########################################################
# Builds Source Release and uploads to Sourceforge #
# Author: Daniel S. Rees (Modified by Tommy Ellqvist) #
@@ -104,12 +104,12 @@ if __name__ == "__main__":
stderr=subprocess.STDOUT)
proc.wait()
if proc.returncode != 0:
- print "ERROR: preparing release."
+ print("ERROR: preparing release.")
if proc.stdout:
- print proc.stdout.readlines()
+ print(proc.stdout.readlines())
sys.exit(1)
- print "Creating tarball: '%s' ..." % TARBALL_FILENAME
+ print("Creating tarball: '%s' ..." % TARBALL_FILENAME)
tarball = None
try:
tarball = tarfile.open(TARBALL_FILENAME, "w:gz")
@@ -124,7 +124,7 @@ if __name__ == "__main__":
for fname in EXPORT_PATHS:
tarball.add(fname, filter=filter_)
except:
- print "ERROR: Failed to create tarball"
+ print("ERROR: Failed to create tarball")
raise
finally:
if tarball is not None:
@@ -136,25 +136,25 @@ if __name__ == "__main__":
upload_attempts = 0
while not uploaded and upload_attempts < SF_UPLOAD_ATTEMPTS:
upload_attempts += 1
- print "Uploading tarball to Sourceforge (attempt %d of %d): '%s' ..." % (upload_attempts, SF_UPLOAD_ATTEMPTS, SF_UPLOAD_CMD)
+ print("Uploading tarball to Sourceforge (attempt %d of %d): '%s' ..." % (upload_attempts, SF_UPLOAD_ATTEMPTS, SF_UPLOAD_CMD))
try:
upload_proc = subprocess.Popen(SF_UPLOAD_CMD, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
upload_log = upload_proc.communicate()[0]
# Indent upload log and print
upload_log = "\n".join([' ' + line for line in upload_log.splitlines()])
- print "Sourceforge Upload Log (attempt %d of %d):\n%s" % (upload_attempts, SF_UPLOAD_ATTEMPTS, upload_log)
+ print("Sourceforge Upload Log (attempt %d of %d):\n%s" % (upload_attempts, SF_UPLOAD_ATTEMPTS, upload_log))
if upload_proc.returncode != 0:
raise Exception("Tarball upload (attempt %d of %d) failed with return code: %s" % (upload_attempts, SF_UPLOAD_ATTEMPTS, upload_proc.returncode))
else:
- print "Tarball upload completed on attempt %d of %d." % (upload_attempts, SF_UPLOAD_ATTEMPTS)
+ print("Tarball upload completed on attempt %d of %d." % (upload_attempts, SF_UPLOAD_ATTEMPTS))
uploaded = True
- except Exception, e:
+ except Exception as e:
if upload_attempts == SF_UPLOAD_ATTEMPTS:
- print "ERROR: Could not upload to sourceforge"
+ print("ERROR: Could not upload to sourceforge")
else:
- print e.args[0]
- print "tarball uploaded to Sourceforge, deleting local tarball"
+ print(e.args[0])
+ print("tarball uploaded to Sourceforge, deleting local tarball")
if os.path.isfile(TARBALL_FILENAME):
os.remove(TARBALL_FILENAME)
- print "Completed Source Build"
+ print("Completed Source Build")
Index: vistrails-3.0~git+9dc22bd/scripts/gen_vtk_examples/check_diffs.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/gen_vtk_examples/check_diffs.py
+++ vistrails-3.0~git+9dc22bd/scripts/gen_vtk_examples/check_diffs.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
@@ -70,11 +70,11 @@ def run(in_dir, out_dir):
other_fname = os.path.join(out_dir, path_end)
cmd_line = "diff %s %s" % (fname, other_fname)
- print cmd_line
+ print(cmd_line)
os.system(cmd_line)
if __name__ == '__main__':
if len(sys.argv) < 3:
- print 'Usage: python %s <in_directory> <out_directory>' % sys.argv[0]
+ print('Usage: python %s <in_directory> <out_directory>' % sys.argv[0])
sys.exit(-1)
run(*sys.argv[1:])
Index: vistrails-3.0~git+9dc22bd/scripts/gen_vtk_examples/convert_to_vt.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/gen_vtk_examples/convert_to_vt.py
+++ vistrails-3.0~git+9dc22bd/scripts/gen_vtk_examples/convert_to_vt.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
@@ -53,47 +53,45 @@ class ConvertVTKToVT(object):
if line.startswith('#!'):
found_starter = True
else:
- print >> out_file, \
- "# This file produced automatically by convert_to_vt.py\n# "
+ print("# This file produced automatically by convert_to_vt.py\n# ", file=out_file)
elif line_count == 1 and found_starter:
- print >> out_file, \
- "# This file produced automatically by convert_to_vt.py\n# "
+ print("# This file produced automatically by convert_to_vt.py\n# ", file=out_file)
found_starter = False
if (line.find('import ') != -1 and line.find('vtk') != -1) or \
line.find('VTK_DATA_ROOT = ') != -1 or \
does_continue:
if line.rstrip() == 'import vtk':
- print >>out_file, 'import sys'
- print >>out_file, 'sys.path.append' + \
- '("/vistrails/src/trunk/scripts/gen_vtk_examples")'
- print >>out_file, 'import vtk_imposter'
- print >>out_file, 'from colors import *'
- print >>out_file, 'vtk = vtk_imposter.vtk()'
- print >>out_file, 'VTK_DATA_ROOT = ""'
- print >>out_file, ''
- print >>out_file, '#', line[:-1]
+ print('import sys', file=out_file)
+ print('sys.path.append' + \
+ '("/vistrails/src/trunk/scripts/gen_vtk_examples")', file=out_file)
+ print('import vtk_imposter', file=out_file)
+ print('from colors import *', file=out_file)
+ print('vtk = vtk_imposter.vtk()', file=out_file)
+ print('VTK_DATA_ROOT = ""', file=out_file)
+ print('', file=out_file)
+ print('#', line[:-1], file=out_file)
else:
if line.rstrip()[-1] == '\\':
does_continue = True
else:
does_continue = False
- print >>out_file, '#', line[:-1]
+ print('#', line[:-1], file=out_file)
else:
out_file.write(line)
line_count += 1
- print >>out_file, '\nif len(sys.argv) > 1:'
- print >>out_file, ' out_filename = sys.argv[1]'
- print >>out_file, 'else:'
- print >>out_file, ' out_filename = None'
- print >>out_file, 'vtk.to_vt(out_filename)'
+ print('\nif len(sys.argv) > 1:', file=out_file)
+ print(' out_filename = sys.argv[1]', file=out_file)
+ print('else:', file=out_file)
+ print(' out_filename = None', file=out_file)
+ print('vtk.to_vt(out_filename)', file=out_file)
out_file.close()
if __name__ == '__main__':
import sys
if len(sys.argv) < 3:
- print 'Usage: %s <in_file> <out_py_file>' % sys.argv[0]
+ print('Usage: %s <in_file> <out_py_file>' % sys.argv[0])
sys.exit(0)
converter = ConvertVTKToVT(*sys.argv[1:])
converter.run()
Index: vistrails-3.0~git+9dc22bd/scripts/gen_vtk_examples/copy_vtk_examples.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/gen_vtk_examples/copy_vtk_examples.py
+++ vistrails-3.0~git+9dc22bd/scripts/gen_vtk_examples/copy_vtk_examples.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
@@ -90,12 +90,12 @@ def run(in_dir, out_dir):
converter = ConvertVTKToVT(fname, out_py_name)
converter.run()
- print >>sys.stderr, "running 'python %s %s'..." % (out_py_name,
- out_vt_name)
+ print("running 'python %s %s'..." % (out_py_name,
+ out_vt_name), file=sys.stderr)
os.system('python %s %s' % (out_py_name, out_vt_name))
if __name__ == '__main__':
if len(sys.argv) < 3:
- print 'Usage: %s <in_directory> <out_directory>' % sys.argv[0]
+ print('Usage: %s <in_directory> <out_directory>' % sys.argv[0])
sys.exit(-1)
run(*sys.argv[1:])
Index: vistrails-3.0~git+9dc22bd/scripts/gen_vtk_examples/gen_vtk_examples.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/gen_vtk_examples/gen_vtk_examples.py
+++ vistrails-3.0~git+9dc22bd/scripts/gen_vtk_examples/gen_vtk_examples.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
@@ -46,7 +46,7 @@ def run(begin_dir, intermediate_dir, out
if __name__ == '__main__':
if len(sys.argv) < 4:
- print "Usage: python %s " % sys.argv[0] + \
- "<begin_dir> <intermediate_dir> <out_dir> [examples_list]"
+ print("Usage: python %s " % sys.argv[0] + \
+ "<begin_dir> <intermediate_dir> <out_dir> [examples_list]")
sys.exit(-1)
run(*sys.argv[1:])
Index: vistrails-3.0~git+9dc22bd/scripts/gen_vtk_examples/get_vtk_examples.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/gen_vtk_examples/get_vtk_examples.py
+++ vistrails-3.0~git+9dc22bd/scripts/gen_vtk_examples/get_vtk_examples.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
@@ -72,11 +72,11 @@ def run(py_dirname, in_dirname, out_dirn
# print "os.system('cp %s %s')" % (vt_name, out_vt_name)
os.system('cp %s %s' % (py_name, out_py_name))
os.system('cp %s %s' % (vt_name, out_vt_name))
- print "%d of %d" % (total_good, total)
+ print("%d of %d" % (total_good, total))
if __name__ == '__main__':
if len(sys.argv) < 5:
- print "Usage: python %s " % sys.argv[0] + \
- "<python_dir> <in_dir> <out_dir> [examples_list]"
+ print("Usage: python %s " % sys.argv[0] + \
+ "<python_dir> <in_dir> <out_dir> [examples_list]")
sys.exit(-1)
run(*sys.argv[1:])
Index: vistrails-3.0~git+9dc22bd/scripts/gen_vtk_examples/vtk_to_vt.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/gen_vtk_examples/vtk_to_vt.py
+++ vistrails-3.0~git+9dc22bd/scripts/gen_vtk_examples/vtk_to_vt.py
@@ -1,3 +1,4 @@
+#!/usr/bin/python3
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
@@ -41,7 +42,7 @@ os.environ['EXECUTABLEPATH'] = ""
import copy
import datetime
import re
-import urllib
+import urllib.request, urllib.parse, urllib.error
from vistrails.db.domain import DBModule, DBConnection, DBPort, DBFunction, \
DBParameter, DBLocation, DBPortSpec, DBTag, DBAnnotation, DBVistrail, \
@@ -234,12 +235,12 @@ class VTK2VT(object):
def save_modules(self):
self.saved_functions = {}
- for k, module in self.vtk_modules.iteritems():
+ for k, module in self.vtk_modules.items():
self.saved_functions[k] = module.functions
module.functions = []
def restore_modules(self):
- for k, module in self.vtk_modules.iteritems():
+ for k, module in self.vtk_modules.items():
module.functions = self.saved_functions[k]
def do_layout(self):
@@ -249,7 +250,7 @@ class VTK2VT(object):
vt_f_connections = self.vt_b_connections
b_connections = copy.deepcopy(vt_b_connections)
f_connections = copy.deepcopy(vt_f_connections)
- for m_id, module in self.vt_modules.iteritems():
+ for m_id, module in self.vt_modules.items():
if m_id not in b_connections:
queue.append((module, 0))
# if module.db_id not in f_connections:
@@ -282,7 +283,7 @@ class VTK2VT(object):
levels[ell].append(m)
module_levels[m.db_id] = ell
- for level, m_list in sorted(levels.iteritems()):
+ for level, m_list in sorted(levels.items()):
for i, m in enumerate(m_list):
if i >= len(m_list) - 1:
continue
@@ -321,7 +322,7 @@ class VTK2VT(object):
dx = 250.0
dy = 100.0
current_y = 0.0
- for level, m_list in levels.iteritems():
+ for level, m_list in levels.items():
current_x = - (len(m_list) * dx) / 2.0
for m in m_list:
m.db_location.db_x = current_x
@@ -345,7 +346,7 @@ class VTK2VT(object):
if found_vtk_cell:
return (module, function_list)
else:
- print >>sys.stderr, "ERROR: cannot find VTKCell for Interactor"
+ print("ERROR: cannot find VTKCell for Interactor", file=sys.stderr)
return (None, None)
def create_functions(self, module, function_list=None, f_pos=0):
@@ -435,7 +436,7 @@ class VTK2VT(object):
# self.inspector_functions:
# print >>sys.stderr, '>>', function._name, 'found in getters'
if not allow_sub:
- print >>sys.stderr, "ERROR: sub function has getter"
+ print("ERROR: sub function has getter", file=sys.stderr)
key = (id(function.parent), function._name)
if key in self.created_modules:
p_module = self.created_modules[key]
@@ -462,7 +463,7 @@ class VTK2VT(object):
else:
p_module = arg.parent
if found_setter and type(p_module) != vtk_module:
- print >>sys.stderr, "ERROR: type of p_module incorrect"
+ print("ERROR: type of p_module incorrect", file=sys.stderr)
found_setter = False
if found_setter:
# print >>sys.stderr, "found", module_name, p_module._name
@@ -739,7 +740,7 @@ class VTK2VT(object):
# probably need to order the function calls here
# ideally, this would be an abstraction of some sort
shared_data = set()
- for s_module in self.vtk_modules.itervalues():
+ for s_module in self.vtk_modules.values():
if len(s_module.functions) > 0:
if not s_module._name == 'vtkRenderWindow':
shared_data.add(s_module)
@@ -795,8 +796,7 @@ class VTK2VT(object):
s_function_str = s_function._name
while len(s_function.sub_functions) > 0:
if len(s_function.sub_functions) > 1:
- print >> sys.stderr, \
- "ERROR: too many subfunctions"
+ print("ERROR: too many subfunctions", file=sys.stderr)
# FIXME need to do args here, too
s_function_str += '().' + \
s_function.sub_functions[0]._name
@@ -832,7 +832,7 @@ class VTK2VT(object):
shared_data.discard(observer_module)
shared_data.discard(handler_module)
handler_module.SharedData(*shared_data)
- handler_module.Handler(urllib.quote(handler_code))
+ handler_module.Handler(urllib.parse.quote(handler_code))
# print >> sys.stderr, "shared_data", shared_data
# functions.append(s_data_function)
self.create_functions(handler_module)
@@ -882,8 +882,7 @@ class VTK2VT(object):
for arg in connections:
self.create_connection(arg, function)
else:
- print >>sys.stderr, \
- "ERROR: sub function has connections"
+ print("ERROR: sub function has connections", file=sys.stderr)
elif len(parameters) > 0:
db_parameters = self.get_parameters(parameters)
db_function = DBFunction(id=self.max_function_id,
@@ -899,8 +898,8 @@ class VTK2VT(object):
def create_port(vtk_module, type, name, other_vtk_module):
# print >>sys.stderr, 'creating port:', vtk_module._name, name
if id(vtk_module) not in self.modules:
- print >>sys.stderr, 'ERROR: cannot create port', \
- vtk_module._name, type, name
+ print('ERROR: cannot create port', \
+ vtk_module._name, type, name, file=sys.stderr)
import traceback
traceback.print_stack()
return (None, None)
@@ -929,8 +928,8 @@ class VTK2VT(object):
while ps_key not in db_module_desc.db_portSpecs_name_index:
base_id = db_module_desc.db_base_descriptor_id
if base_id < 0:
- print >>sys.stderr, 'ERROR: cannot create port', \
- vtk_module._name, type, name
+ print('ERROR: cannot create port', \
+ vtk_module._name, type, name, file=sys.stderr)
import traceback
traceback.print_stack()
return (None, None)
@@ -972,8 +971,7 @@ class VTK2VT(object):
(found_module, _) = self.find_or_create_module(entity.parent)
port_name = entity._name
if not found_module:
- print >>sys.stderr, \
- "ERROR: cannot convert function", entity._name
+ print("ERROR: cannot convert function", entity._name, file=sys.stderr)
# elif type(entity) == vtk_function:
# found_module = self.find_or_create_module(entity)
@@ -990,8 +988,8 @@ class VTK2VT(object):
# found_module = entity.parent
# port_name = entity._name
else:
- print >>sys.stderr, 'ERROR: cannot deal with type "' + \
- str(type(entity))
+ print('ERROR: cannot deal with type "' + \
+ str(type(entity)), file=sys.stderr)
found_module = None
port_name = None
return (found_module, port_name)
@@ -1051,8 +1049,8 @@ class VTK2VT(object):
# str(type(dst)) + '"'
if not src_module or not dst_module:
- print >>sys.stderr, 'ERROR: cannot create connection', \
- src._name, dst._name
+ print('ERROR: cannot create connection', \
+ src._name, dst._name, file=sys.stderr)
return None
# print >>sys.stderr, 'creating connection:', \
# src_module.db_name, dst_module.db_name
@@ -1079,10 +1077,10 @@ class VTK2VT(object):
import vistrails.db.services.action
action_list = []
- for module in self.modules.itervalues():
+ for module in self.modules.values():
# print 'module:', module._name, id(module)
action_list.append(('add', module))
- for connection_list in self.connections.itervalues():
+ for connection_list in self.connections.values():
for connection in connection_list:
# print 'connection:', connection._name, id(connection)
action_list.append(('add', connection))
@@ -1093,7 +1091,7 @@ class VTK2VT(object):
action.db_user = 'dakoop'
action.db_date = datetime.datetime.now()
- tag = DBTag(name='Auto-Translated', id=1L)
+ tag = DBTag(name='Auto-Translated', id=1)
op_id = 0
for op in action.db_operations:
@@ -1114,5 +1112,5 @@ class VTK2VT(object):
vistrails.db.services.io.save_bundle_to_zip_xml(SaveBundle(DBVistrail.vtType, vistrail), filename)
else:
f = None
- print >>f, vistrails.db.services.io.serialize(vistrail)
+ print(vistrails.db.services.io.serialize(vistrail), file=f)
Index: vistrails-3.0~git+9dc22bd/scripts/get_usersguide.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/get_usersguide.py
+++ vistrails-3.0~git+9dc22bd/scripts/get_usersguide.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
@@ -38,7 +38,7 @@
import os.path
import subprocess
import sys
-import urllib2
+import urllib.request, urllib.error, urllib.parse
this_dir = os.path.dirname(os.path.abspath(__file__))
@@ -65,8 +65,8 @@ def which(program):
return None
def download_usersguide():
- print "Downloading usersguide from", DOWNLOAD_URL
- response = urllib2.urlopen(DOWNLOAD_URL)
+ print("Downloading usersguide from", DOWNLOAD_URL)
+ response = urllib.request.urlopen(DOWNLOAD_URL)
filename = os.path.join(SAVE_TO,
DOWNLOAD_URL.split('/')[-1])
f = open(filename, 'wb')
@@ -75,10 +75,10 @@ def download_usersguide():
if __name__ == "__main__":
if which('sphinx-build') is None:
- print "Sphinx is not installed!"
+ print("Sphinx is not installed!")
download_usersguide()
elif which('pdflatex') is None:
- print "pdflatex is not installed!"
+ print("pdflatex is not installed!")
download_usersguide()
else:
cwd = os.getcwd()
@@ -90,9 +90,9 @@ if __name__ == "__main__":
stderr=subprocess.STDOUT)
proc.wait()
if proc.returncode != 0:
- print "ERROR: building usersguide failed."
+ print("ERROR: building usersguide failed.")
if proc.stdout:
- print proc.stdout.readlines()
+ print(proc.stdout.readlines())
sys.exit(1)
os.chdir(this_dir)
Index: vistrails-3.0~git+9dc22bd/scripts/merge_vistrails.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/merge_vistrails.py
+++ vistrails-3.0~git+9dc22bd/scripts/merge_vistrails.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
@@ -61,7 +61,7 @@ def main(out_fname, in_fnames):
if __name__ == '__main__':
if len(sys.argv) < 3:
- print "Usage: %s [output filename] [list of input vistrails]" % \
- sys.argv[0]
+ print("Usage: %s [output filename] [list of input vistrails]" % \
+ sys.argv[0])
sys.exit(0)
main(sys.argv[1], sys.argv[2:])
Index: vistrails-3.0~git+9dc22bd/scripts/opm/opm2dot.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/opm/opm2dot.py
+++ vistrails-3.0~git+9dc22bd/scripts/opm/opm2dot.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
@@ -53,8 +53,8 @@ def run(filename, account=None):
return True
return False
- print 'digraph {'
- print 'edge [dir = "back", style="dashed"];'
+ print('digraph {')
+ print('edge [dir = "back", style="dashed"];')
for process in root.getiterator('processes').next().getiterator('process'):
if not should_include(process):
continue
@@ -75,13 +75,13 @@ def run(filename, account=None):
shape = 'hexagon'
else:
shape = 'box'
- print '%d [label="%s", shape=%s, color=blue];' % \
- (node_id, process_label, shape)
+ print('%d [label="%s", shape=%s, color=blue];' % \
+ (node_id, process_label, shape))
lookup[process_id] = node_id
node_id += 1
if error is not None:
- print '%d [label="ERROR: %s", shape=octagon, color=black];' % (node_id,
- error)
+ print('%d [label="ERROR: %s", shape=octagon, color=black];' % (node_id,
+ error))
error_edges.append((node_id - 1, node_id))
node_id += 1
@@ -106,7 +106,7 @@ def run(filename, account=None):
if len(param_val) > 32:
if param.get('type') == \
'edu.utah.sci.vistrails.basic:File':
- print >>sys.stderr, "got here"
+ print("got here", file=sys.stderr)
dir_names = []
dir_name = param_val
while os.path.split(dir_name)[1]:
@@ -126,19 +126,18 @@ def run(filename, account=None):
else:
j += 1
dir_names[-1] = '_'.join(arr[:i] + ['...'] + arr[-j:])
- print >>sys.stderr, dir_names
+ print(dir_names, file=sys.stderr)
i = 1
while (len(os.path.join(dir_names[0], dir_names[1],
'...',
*dir_names[-i:])) < 32 and
i+1 < len(dir_names)):
- print >>sys.stderr, \
- len(os.path.join(dir_names[0],
+ print(len(os.path.join(dir_names[0],
dir_names[1],
'...',
- *dir_names[-i:]))
+ *dir_names[-i:])), file=sys.stderr)
i += 1
- print >>sys.stderr, i
+ print(i, file=sys.stderr)
param_val = os.path.join(dir_names[0],
dir_names[1], '...',
*dir_names[-i:])
@@ -148,40 +147,40 @@ def run(filename, account=None):
comma = ', '
artifact_label += ')'
else:
- print >>sys.stderr, "ERROR:", child.tag
+ print("ERROR:", child.tag, file=sys.stderr)
artifact_label = artifact.get('id')
- print '%d [label="%s", color=red];' % (node_id, artifact_label)
+ print('%d [label="%s", color=red];' % (node_id, artifact_label))
lookup[artifact_id] = node_id
node_id += 1
for used in root.getiterator('causalDependencies').next().getiterator('used'):
if not should_include(used):
continue
- print "%d -> %d;" % \
+ print("%d -> %d;" % \
(lookup[used.getiterator('cause').next().get('id')],
- lookup[used.getiterator('effect').next().get('id')])
+ lookup[used.getiterator('effect').next().get('id')]))
for wgb in root.getiterator('causalDependencies').next().getiterator('wasGeneratedBy'):
if not should_include(wgb):
continue
- print "%d -> %d;" % \
+ print("%d -> %d;" % \
(lookup[wgb.getiterator('cause').next().get('id')],
- lookup[wgb.getiterator('effect').next().get('id')])
+ lookup[wgb.getiterator('effect').next().get('id')]))
for wtb in root.getiterator('causalDependencies').next().getiterator('wasTriggeredBy'):
if not should_include(wtb):
continue
- print "%d -> %d;" % \
+ print("%d -> %d;" % \
(lookup[wtb.getiterator('cause').next().get('id')],
- lookup[wtb.getiterator('effect').next().get('id')])
+ lookup[wtb.getiterator('effect').next().get('id')]))
for error_edge in error_edges:
- print "%d -> %d;" % error_edge
- print "}"
+ print("%d -> %d;" % error_edge)
+ print("}")
if __name__ == '__main__':
if len(sys.argv) < 2:
- print "Usage: python %s <opm_file> [account]" % sys.argv[0]
+ print("Usage: python %s <opm_file> [account]" % sys.argv[0])
sys.exit(42)
account = sys.argv[2] if len(sys.argv) > 2 else None
run(sys.argv[1], account)
Index: vistrails-3.0~git+9dc22bd/scripts/release_notes.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/release_notes.py
+++ vistrails-3.0~git+9dc22bd/scripts/release_notes.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
@@ -39,7 +39,7 @@ tickets. Use the configuration section b
The text will be written to the standard output.
"""
-import xmlrpclib
+import xmlrpc.client
import git
import getpass
import os
@@ -74,9 +74,9 @@ def userpass(realm, u, may_save):
global username
global password
if not username:
- print "Username:",
+ print("Username:", end=' ')
sys.stdout.flush()
- username = raw_input()
+ username = input()
password = getpass.getpass()
return True, username, password, False
@@ -91,17 +91,17 @@ def clone_vistrails_git_repository(path_
global cloneremote
cmdlist = ['git', 'clone', cloneremote,
path_to]
- print "Cloning vistrails from:"
- print " %s to"%cloneremote
- print " %s"%path_to
- print "Be patient. This may take a while."
+ print("Cloning vistrails from:")
+ print(" %s to"%cloneremote)
+ print(" %s"%path_to)
+ print("Be patient. This may take a while.")
process = subprocess.Popen(cmdlist, shell=False,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
process.wait()
if process.returncode == 0:
- print "repository is cloned."
+ print("repository is cloned.")
return process.returncode
################################################################################
@@ -116,9 +116,9 @@ def init_repo():
ok = True
init_branch(clonepath,branch)
need_cleanup = True
- except Exception, e:
- print "ERROR: Could not clone vistrails repository!"
- print str(e)
+ except Exception as e:
+ print("ERROR: Could not clone vistrails repository!")
+ print(str(e))
shutil.rmtree(clonepath)
sys.exit(1)
else:
@@ -129,7 +129,7 @@ def init_repo():
repo = git.Repo(clonepath)
return repo
else:
- print "ERROR: git clone failed."
+ print("ERROR: git clone failed.")
sys.exit(1)
################################################################################
@@ -143,7 +143,7 @@ def cleanup_repo():
def init_branch(path_to, branch):
cmdlist = ['git', 'checkout', "%s"%branch]
- print "Checking out %s branch..."%branch
+ print("Checking out %s branch..."%branch)
current_dir = os.getcwd()
os.chdir(path_to)
process = subprocess.Popen(cmdlist, shell=False,
@@ -153,9 +153,9 @@ def init_branch(path_to, branch):
process.wait()
lines = process.stdout.readlines()
for line in lines:
- print " ", line
+ print(" ", line)
if process.returncode == 0:
- print "Branch %s was checked out."%branch
+ print("Branch %s was checked out."%branch)
os.chdir(current_dir)
return process.returncode
@@ -163,7 +163,7 @@ def init_branch(path_to, branch):
def pull_changes(path_to):
cmdlist = ['git', 'pull']
- print "Pulling changes into the branch..."
+ print("Pulling changes into the branch...")
current_dir = os.getcwd()
os.chdir(path_to)
process = subprocess.Popen(cmdlist, shell=False,
@@ -173,9 +173,9 @@ def pull_changes(path_to):
process.wait()
lines = process.stdout.readlines()
for line in lines:
- print " ", line
+ print(" ", line)
if process.returncode == 0:
- print "Changes were pulled."
+ print("Changes were pulled.")
os.chdir(current_dir)
return process.returncode
@@ -253,29 +253,29 @@ def build_release_notes(repo, branch):
#get ticket summaries from xmlrpc plugin installed on vistrails trac
- print "Will connect to VisTrails Trac with authentication..."
+ print("Will connect to VisTrails Trac with authentication...")
if not username:
- print "Username:",
+ print("Username:", end=' ')
sys.stdout.flush()
- username = raw_input()
+ username = input()
password = getpass.getpass()
url = "https://%s:%s@www.vistrails.org/login/xmlrpc"%(username,
password)
- server = xmlrpclib.ServerProxy(url)
- print "downloading tickets.",
- for (tid,r) in tickets.items():
- print ".",
+ server = xmlrpc.client.ServerProxy(url)
+ print("downloading tickets.", end=' ')
+ for (tid,r) in list(tickets.items()):
+ print(".", end=' ')
sys.stdout.flush()
try:
ticket_info[tid] = server.ticket.get(tid)
- except Exception, e:
+ except Exception as e:
del tickets[tid]
- print "commit %s: Could not get info for ticket %s"%(r,tid)
- print "done."
+ print("commit %s: Could not get info for ticket %s"%(r,tid))
+ print("done.")
#place tickets on bugfixes or enhancements
- for (tid,r) in tickets.iteritems():
+ for (tid,r) in tickets.items():
txt = "Ticket %s: %s"%(tid,ticket_info[tid][3]['summary'])
if ticket_info[tid][3]['type'] == 'enhancement':
features[txt] = r
@@ -287,43 +287,43 @@ def build_release_notes(repo, branch):
if commit_end == "HEAD" and len(logs) > 0:
commit_end = logs[0].hexsha
- print
- print
- print "Release Name: v%s build %s from %s branch" % (release_name,
+ print()
+ print()
+ print("Release Name: v%s build %s from %s branch" % (release_name,
commit_end[0:12],
- branch)
- print
- print "Enhancements:"
+ branch))
+ print()
+ print("Enhancements:")
times = []
- for t, r in features.iteritems():
+ for t, r in features.items():
times.append((log_map_time[r], t))
revisions = sorted(times)
revisions.reverse()
for (t,text) in revisions:
r = features[text]
- print " - %s (%s)" %(rstrip(text),r[0:12])
+ print(" - %s (%s)" %(rstrip(text),r[0:12]))
- print
- print "Bug fixes:"
+ print()
+ print("Bug fixes:")
times = []
- for t, r in bugfixes.iteritems():
+ for t, r in bugfixes.items():
times.append((log_map_time[r], t))
revisions = sorted(times)
revisions.reverse()
for (t,text) in revisions:
r = bugfixes[text]
- print " - %s (%s)" %(rstrip(text),r[0:12])
+ print(" - %s (%s)" %(rstrip(text),r[0:12]))
- print
- print "Other changes:"
+ print()
+ print("Other changes:")
times = []
- for t, r in changes.iteritems():
+ for t, r in changes.items():
times.append((log_map_time[r], t))
revisions = sorted(times)
revisions.reverse()
for (t,text) in revisions:
r = changes[text]
- print " - %s (%s)" %(text.split('\n')[0][0:100].rstrip(),r[0:12])
+ print(" - %s (%s)" %(text.split('\n')[0][0:100].rstrip(),r[0:12]))
if __name__ == "__main__":
repo = init_repo()
Index: vistrails-3.0~git+9dc22bd/scripts/build_usersguide.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/build_usersguide.py
+++ vistrails-3.0~git+9dc22bd/scripts/build_usersguide.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
@@ -83,7 +83,7 @@ if __name__ == '__main__':
os.path.exists(PATH_TO_VISTRAILS_GIT)):
current_folder = os.getcwd()
if PERFORM_GIT_PULL:
- print "performing git pull in %s..."%PATH_TO_VISTRAILS_GIT
+ print("performing git pull in %s..."%PATH_TO_VISTRAILS_GIT)
os.chdir(PATH_TO_VISTRAILS_GIT)
proc = subprocess.Popen(GIT_PULL_CMD,
stdin=subprocess.PIPE,
@@ -91,9 +91,9 @@ if __name__ == '__main__':
stderr=subprocess.STDOUT)
proc.wait()
if proc.returncode != 0:
- print "ERROR: git pull failed."
+ print("ERROR: git pull failed.")
if proc.stdout:
- print proc.stdout.readlines()
+ print(proc.stdout.readlines())
# The api needs path to source set
env = os.environ.copy()
@@ -102,10 +102,10 @@ if __name__ == '__main__':
os.chdir(os.path.join(PATH_TO_VISTRAILS_GIT,
*USERSGUIDE_SUBPATH))
- print "Going into directory %s"%os.getcwd()
+ print("Going into directory %s"%os.getcwd())
if BUILD_HTML:
# now build html documentation
- print "now building html documentation..."
+ print("now building html documentation...")
proc = subprocess.Popen(["make", "html"],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
@@ -113,9 +113,9 @@ if __name__ == '__main__':
env=env)
proc.wait()
if proc.returncode != 0:
- print "ERROR: make html failed."
+ print("ERROR: make html failed.")
if proc.stdout:
- print proc.stdout.readlines()
+ print(proc.stdout.readlines())
else:
# now move files to their final place
if HTML_FOLDER is not None:
@@ -126,19 +126,19 @@ if __name__ == '__main__':
shutil.move(html_build, HTML_FOLDER)
if BUILD_PDF:
- print "Building usersguide to ", PDF_FILE
+ print("Building usersguide to ", PDF_FILE)
#build latex files
- print "now preparing latex files..."
+ print("now preparing latex files...")
latex_path = os.path.join(".",
*BUILD_LATEX_SUBPATH)
if os.path.exists(latex_path):
- print "removing old %s directory..."%latex_path
+ print("removing old %s directory..."%latex_path)
proc = subprocess.Popen(["rm", "-rf", latex_path],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
proc.wait()
- print "building latex files..."
+ print("building latex files...")
proc = subprocess.Popen(["make", "latex"],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
@@ -146,12 +146,12 @@ if __name__ == '__main__':
env=env)
proc.wait()
if proc.returncode != 0:
- print "ERROR: make latex failed."
+ print("ERROR: make latex failed.")
if proc.stdout:
- print proc.stdout.readlines()
+ print(proc.stdout.readlines())
else:
#now build pdf
- print "now building pdf file..."
+ print("now building pdf file...")
os.chdir(os.path.join(os.getcwd(),
*BUILD_LATEX_SUBPATH))
proc = subprocess.Popen(["make", "LATEXOPTS=-interaction=nonstopmode -halt-on-error", "all-pdf"],
@@ -161,8 +161,8 @@ if __name__ == '__main__':
env=env)
output, error = proc.communicate()
if proc.returncode != 0:
- print "ERROR: make all-pdf failed."
- print output, error
+ print("ERROR: make all-pdf failed.")
+ print(output, error)
else:
#now move file to its final place
if PDF_FILE is not None:
@@ -172,6 +172,6 @@ if __name__ == '__main__':
PDF_BUILD_NAME)
shutil.move(pdf_build, PDF_FILE)
os.chdir(current_folder)
- print "Done."
+ print("Done.")
else:
- print "PATH_TO_VISTRAILS_GIT was not provided. Exiting."
+ print("PATH_TO_VISTRAILS_GIT was not provided. Exiting.")
Index: vistrails-3.0~git+9dc22bd/scripts/extract.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/extract.py
+++ vistrails-3.0~git+9dc22bd/scripts/extract.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
@@ -54,7 +54,7 @@ def copy_dir(src, dst):
if __name__ == "__main__":
if len(sys.argv) != 2:
- print "Usage: python extract.py resource_rc"
+ print("Usage: python extract.py resource_rc")
sys.exit(0)
module_name = sys.argv[1]
Index: vistrails-3.0~git+9dc22bd/vistrails/vistrails_server.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/vistrails/vistrails_server.py
+++ vistrails-3.0~git+9dc22bd/vistrails/vistrails_server.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
@@ -80,12 +80,12 @@ if __name__ == '__main__':
args=sys.argv[1:])
app = vistrails.gui.application_server.VistrailsServer()
except SystemExit as e:
- print(str(e))
+ print((str(e)))
sys.exit(e)
except Exception as e:
import traceback
- print("Uncaught exception on initialization: %s" % (
- traceback._format_final_exc_line(type(e).__name__, e)))
+ print(("Uncaught exception on initialization: %s" % (
+ traceback._format_final_exc_line(type(e).__name__, e))))
traceback.print_exc()
sys.exit(255)
Index: vistrails-3.0~git+9dc22bd/scripts/add_future_import.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/add_future_import.py
+++ vistrails-3.0~git+9dc22bd/scripts/add_future_import.py
@@ -1,5 +1,5 @@
-#!/usr/bin/env python
-from __future__ import absolute_import, unicode_literals
+#!/usr/bin/python3
+
import argparse
import logging
Index: vistrails-3.0~git+9dc22bd/scripts/delete_from_db.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/delete_from_db.py
+++ vistrails-3.0~git+9dc22bd/scripts/delete_from_db.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
Index: vistrails-3.0~git+9dc22bd/scripts/dist/common/set_version.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/dist/common/set_version.py
+++ vistrails-3.0~git+9dc22bd/scripts/dist/common/set_version.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
Index: vistrails-3.0~git+9dc22bd/scripts/force_start_vistrails_nonohup.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/force_start_vistrails_nonohup.py
+++ vistrails-3.0~git+9dc22bd/scripts/force_start_vistrails_nonohup.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
Index: vistrails-3.0~git+9dc22bd/scripts/force_start_vistrails.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/force_start_vistrails.py
+++ vistrails-3.0~git+9dc22bd/scripts/force_start_vistrails.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
Index: vistrails-3.0~git+9dc22bd/scripts/generate_pkg_doc.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/generate_pkg_doc.py
+++ vistrails-3.0~git+9dc22bd/scripts/generate_pkg_doc.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
import itertools
import sys
@@ -17,14 +17,14 @@ def trim_docstring(docstring):
# and split into a list of lines:
lines = docstring.expandtabs().splitlines()
# Determine minimum indentation (first line doesn't count):
- indent = sys.maxint
+ indent = sys.maxsize
for line in lines[1:]:
stripped = line.lstrip()
if stripped:
indent = min(indent, len(line) - len(stripped))
# Remove indentation (first line is special):
trimmed = [lines[0].strip()]
- if indent < sys.maxint:
+ if indent < sys.maxsize:
for line in lines[1:]:
trimmed.append(line[indent:].rstrip())
# Strip off trailing and leading blank lines:
@@ -49,61 +49,61 @@ def get_examples(desc):
def generate_module_doc(desc, f=None, depth=1, inherited=True):
reg = get_module_registry()
- print >>f, desc.name
- print >>f, heading_order[depth] * len(desc.name)
- print >>f, ""
- print >>f, ".. py:class:: %s" % desc.name
- print >>f, ""
+ print(desc.name, file=f)
+ print(heading_order[depth] * len(desc.name), file=f)
+ print("", file=f)
+ print(".. py:class:: %s" % desc.name, file=f)
+ print("", file=f)
if desc.module.__doc__:
- print >>f, format_docstring(desc.module.__doc__, 2)
- print >>f, ""
+ print(format_docstring(desc.module.__doc__, 2), file=f)
+ print("", file=f)
if inherited:
input_ports = reg.module_destination_ports_from_descriptor(True, desc)
output_ports = reg.module_source_ports_from_descriptor(True, desc)
else:
- input_ports = reg.module_ports('input', desc).values()
+ input_ports = list(reg.module_ports('input', desc).values())
input_ports.sort(key=lambda x: (x.sort_key, x.id))
- output_ports = reg.module_ports('output', desc).values()
+ output_ports = list(reg.module_ports('output', desc).values())
output_ports.sort(key=lambda x: (x.sort_key, x.id))
if len(input_ports) > 0:
- print >>f, " *Input Ports*"
+ print(" *Input Ports*", file=f)
for port in input_ports:
sigstring = port.sigstring.replace(':', '.')[1:-1]
- print >>f, " .. py:attribute:: %s" % port.name
- print >>f, ""
- print >>f, " | *Signature*: :py:class:`%s`" % sigstring
+ print(" .. py:attribute:: %s" % port.name, file=f)
+ print("", file=f)
+ print(" | *Signature*: :py:class:`%s`" % sigstring, file=f)
if port.docstring():
- print >>f, " | *Description*: %s" % format_docstring(port.docstring(), 9)
- print >>f, ""
+ print(" | *Description*: %s" % format_docstring(port.docstring(), 9), file=f)
+ print("", file=f)
if len(output_ports) > 0:
- print >>f, " *Output Ports*"
+ print(" *Output Ports*", file=f)
for port in output_ports:
sigstring = port.sigstring.replace(':', '.')[1:-1]
- print >>f, " .. py:attribute:: %s" % port.name
- print >>f, ""
- print >>f, " | *Signature*: :py:class:`%s`" % sigstring
+ print(" .. py:attribute:: %s" % port.name, file=f)
+ print("", file=f)
+ print(" | *Signature*: :py:class:`%s`" % sigstring, file=f)
if port.docstring():
- print >>f, " | *Description*: %s" % format_docstring(port.docstring(), 9)
- print >>f, ""
+ print(" | *Description*: %s" % format_docstring(port.docstring(), 9), file=f)
+ print("", file=f)
examples = get_examples(desc)
if len(examples) > 0:
- print >>f, " *Examples*"
+ print(" *Examples*", file=f)
for example in examples:
- print >>f, " * %s" % example
- print >>f, ""
+ print(" * %s" % example, file=f)
+ print("", file=f)
def generate_docs(pkg, namespace=None, f=None):
- print >>f, pkg._package.name
- print >>f, heading_order[0] * len(pkg._package.name)
- print >>f, ""
- print >>f, ".. py:module:: %s\n" % pkg._package.identifier
- print >>f, '| *Identifier*: %s' % pkg._package.identifier
- print >>f, '| *Version*: %s\n' % pkg._package.version
- print >>f, format_docstring(pkg._package.description, 0)
- print >>f, ""
+ print(pkg._package.name, file=f)
+ print(heading_order[0] * len(pkg._package.name), file=f)
+ print("", file=f)
+ print(".. py:module:: %s\n" % pkg._package.identifier, file=f)
+ print('| *Identifier*: %s' % pkg._package.identifier, file=f)
+ print('| *Version*: %s\n' % pkg._package.version, file=f)
+ print(format_docstring(pkg._package.description, 0), file=f)
+ print("", file=f)
if namespace == '':
for desc in pkg._namespaces[1]:
@@ -114,27 +114,27 @@ def generate_docs(pkg, namespace=None, f
for desc in pkg._namespaces[1]:
generate_module_doc(desc, f)
namespaces = sorted(item + (1,) for item in
- pkg._namespaces[0].iteritems())
+ pkg._namespaces[0].items())
else:
namespace_dict = pkg._namespaces[0]
descs = pkg._namespaces[1]
split_ns = namespace.split('|')
for i, ns in enumerate(split_ns):
- print >>f, ns
- print >>f, heading_order[i+1] * len(ns)
- print >>f, ""
+ print(ns, file=f)
+ print(heading_order[i+1] * len(ns), file=f)
+ print("", file=f)
(namespace_dict, descs) = namespace_dict[ns]
namespaces = [(namespace, (namespace_dict, descs), len(split_ns))]
for (ns, (child_namespaces, descs), depth) in namespaces:
- print >>f, ns
- print >>f, heading_order[depth] * len(ns)
- print >>f, ""
+ print(ns, file=f)
+ print(heading_order[depth] * len(ns), file=f)
+ print("", file=f)
for desc in descs:
generate_module_doc(desc, f, depth+1)
namespaces = \
itertools.chain([(ns + '|' + c[0], c[1])
- for c in child_namespaces.iteritems()],
+ for c in child_namespaces.items()],
namespaces, depth+1)
def run():
Index: vistrails-3.0~git+9dc22bd/scripts/module_appearance/main.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/module_appearance/main.py
+++ vistrails-3.0~git+9dc22bd/scripts/module_appearance/main.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
Index: vistrails-3.0~git+9dc22bd/scripts/update_vistrails_command.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/update_vistrails_command.py
+++ vistrails-3.0~git+9dc22bd/scripts/update_vistrails_command.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
|