Changeset 19207
- Timestamp:
- 08/14/06 16:38:16 (2 years ago)
- Files:
-
- juggler/branches/2.0/buildwin32.py (modified) (30 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
juggler/branches/2.0/buildwin32.py
r19042 r19207 34 34 35 35 import glob 36 import os 36 import os, os.path 37 37 import re 38 38 import shutil … … 41 41 import traceback 42 42 import getopt 43 pj = os.path.join 43 44 44 45 EXIT_STATUS_SUCCESS = 0 … … 765 766 mkinstalldirs(os.path.join(prefix, 'share')) 766 767 768 def smartCopy(srcfile, dst): 769 """ Only copy file if it has changed, and delete it first. 770 Drop in replacement for shutil.copy2. 771 srcfile - Full path to source file to copy. 772 dst - Destination filename or directory. 773 """ 774 if os.path.isdir(dst): 775 dst = os.path.join(dst, os.path.basename(srcfile)) 776 777 # Verify we need to copy and make sure to delete if needed 778 if os.path.isfile(dst): 779 stat_src = os.stat(srcfile) 780 stat_dst = os.stat(dst) 781 if (stat_src.st_size == stat_dst.st_size) and \ 782 (stat_src.st_mtime == stat_dst.st_mtime): 783 #print "skipping: ", dst 784 return # File doesn't need to be copied 785 #print "removing: ", dst 786 os.remove(dst) 787 788 # Copy it 789 shutil.copy2(srcfile, dst) 790 791 767 792 def installDir(startDir, destDir, allowedExts = None, disallowedExts = None, 768 793 disallowedFiles = None): 794 #print " %s ==> %s"%(startDir, destDir) 769 795 cwd = os.getcwd() 770 796 … … 802 828 disallowedFiles) 803 829 else: 804 (root, f_ext) = os.path.splitext(f) 805 if allowedExts is None: 806 if f_ext not in disallowedExts: 807 shutil.copy2(f, destDir) 808 elif f_ext in allowedExts: 809 if f not in disallowedFiles: 810 shutil.copy2(f, destDir) 830 try: 831 (root, f_ext) = os.path.splitext(f) 832 if allowedExts is None: 833 if f_ext not in disallowedExts: 834 smartCopy(f, pj(destDir,f)) 835 elif f_ext in allowedExts: 836 if f not in disallowedFiles: 837 smartCopy(f, pj(destDir,f)) 838 except (IOError, os.error), why: 839 print "Can't copy %s to %s: %s" % (f, destDir, str(why)) 811 840 812 841 os.chdir(cwd) … … 851 880 srcroot = os.path.join(gJugglerDir, 'modules', 'vapor') 852 881 853 s hutil.copy2(os.path.join(gJugglerDir, 'COPYING.txt'), destdir)882 smartCopy(os.path.join(gJugglerDir, 'COPYING.txt'), destdir) 854 883 extra_files = ['ChangeLog', 'README.txt', 'RELEASE_NOTES.txt'] 855 884 for f in extra_files: 856 s hutil.copy2(os.path.join(srcroot, f), destdir)885 smartCopy(os.path.join(srcroot, f), destdir) 857 886 858 887 def installTweek(prefix, buildDir): … … 882 911 srcroot = os.path.join(gJugglerDir, 'modules', 'tweek') 883 912 884 s hutil.copy2(os.path.join(gJugglerDir, 'COPYING.txt'), destdir)913 smartCopy(os.path.join(gJugglerDir, 'COPYING.txt'), destdir) 885 914 extra_files = ['ChangeLog', 'RELEASE_NOTES.txt'] 886 915 for f in extra_files: 887 s hutil.copy2(os.path.join(srcroot, f), destdir)916 smartCopy(os.path.join(srcroot, f), destdir) 888 917 889 918 def installTweekJava(prefix, buildDir): … … 919 948 # Install the base JAR files that make up the Tweek Java API. 920 949 for j in jars: 921 s hutil.copy2(os.path.join(srcdir, j), destdir)950 smartCopy(os.path.join(srcdir, j), destdir) 922 951 923 952 # Install the tweek_jni DLL. … … 929 958 destdir = os.path.join(destdir, arch) 930 959 mkinstalldirs(destdir) 931 s hutil.copy2(dll, destdir)960 smartCopy(dll, destdir) 932 961 933 962 destdir = os.path.join(prefix, 'share', 'tweek', 'beans') … … 941 970 jar = b + '.jar' 942 971 xml = b + '.xml' 943 s hutil.copy2(os.path.join(bean_srcdir, jar), destdir)944 s hutil.copy2(os.path.join(xml_srcdir, xml), destdir)972 smartCopy(os.path.join(bean_srcdir, jar), destdir) 973 smartCopy(os.path.join(xml_srcdir, xml), destdir) 945 974 946 975 xml_srcdir = os.path.join(gJugglerDir, 'modules', 'tweek', 'extensions', … … 951 980 jar = b + '.jar' 952 981 xml = b + '.xml' 953 s hutil.copy2(os.path.join(bean_srcdir, jar), destdir)954 s hutil.copy2(os.path.join(xml_srcdir, xml), destdir)982 smartCopy(os.path.join(bean_srcdir, jar), destdir) 983 smartCopy(os.path.join(xml_srcdir, xml), destdir) 955 984 956 985 # Install tweek.bat. 957 986 srcdir = os.path.join(gJugglerDir, 'modules', 'tweek', 'java') 958 987 destdir = os.path.join(prefix, 'bin') 959 s hutil.copy2(os.path.join(srcdir, 'tweek.bat'), destdir)988 smartCopy(os.path.join(srcdir, 'tweek.bat'), destdir) 960 989 961 990 # Install JacORB IDL compiler. 962 991 srcdir = os.path.join(gJugglerDir, 'external', 'JacORB') 963 992 installDir(srcdir, destdir, ['.jar']) 964 s hutil.copy2(os.path.join(srcdir, 'idl.bat'), destdir)993 smartCopy(os.path.join(srcdir, 'idl.bat'), destdir) 965 994 966 995 # Destination for all remaining .jar files. … … 982 1011 srcroot = os.path.join(gJugglerDir, 'external', 'swing-laf') 983 1012 for j in laf_jars: 984 s hutil.copy2(os.path.join(srcroot, j), destdir)1013 smartCopy(os.path.join(srcroot, j), destdir) 985 1014 else: 986 1015 printStatus("Tweek Java API not built. Skipping.") … … 1020 1049 '3.0') 1021 1050 mkinstalldirs(destdir) 1022 s hutil.copy2(os.path.join(srcdir, 'configuration.xsd'), destdir)1051 smartCopy(os.path.join(srcdir, 'configuration.xsd'), destdir) 1023 1052 1024 1053 destdir = os.path.join(schema_root, 'www.vrjuggler.org', 'jccl', 'xsd', 1025 1054 '3.1') 1026 1055 mkinstalldirs(destdir) 1027 s hutil.copy2(os.path.join(srcdir, 'definition.xsd'), destdir)1056 smartCopy(os.path.join(srcdir, 'definition.xsd'), destdir) 1028 1057 1029 1058 destdir = schema_root … … 1036 1065 srcroot = os.path.join(gJugglerDir, 'modules', 'jackal') 1037 1066 1038 s hutil.copy2(os.path.join(gJugglerDir, 'COPYING.txt'), destdir)1067 smartCopy(os.path.join(gJugglerDir, 'COPYING.txt'), destdir) 1039 1068 extra_files = ['ChangeLog', 'RELEASE_NOTES.txt'] 1040 1069 for f in extra_files: 1041 s hutil.copy2(os.path.join(srcroot, f), destdir)1070 smartCopy(os.path.join(srcroot, f), destdir) 1042 1071 1043 1072 def installJCCLPlugins(prefix, buildDir): … … 1063 1092 1064 1093 for j in jars: 1065 s hutil.copy2(os.path.join(srcdir, j), destdir)1094 smartCopy(os.path.join(srcdir, j), destdir) 1066 1095 1067 1096 srcdir = os.path.join(gJugglerDir, 'modules', 'jackal', 'config') 1068 s hutil.copy2(os.path.join(srcdir, 'jccl_config.xml'), destdir)1097 smartCopy(os.path.join(srcdir, 'jccl_config.xml'), destdir) 1069 1098 1070 1099 # Install dependencies. … … 1078 1107 mkinstalldirs(destdir) 1079 1108 for j in dep_jars: 1080 s hutil.copy2(os.path.join(srcroot, j), destdir)1109 smartCopy(os.path.join(srcroot, j), destdir) 1081 1110 else: 1082 1111 printStatus("JCCL Java API not built. Skipping.") … … 1089 1118 1090 1119 destdir = os.path.join(prefix, 'share', 'jccl', 'beans') 1091 s hutil.copy2(os.path.join(srcdir, 'jccl_rtrc.jar'), destdir)1120 smartCopy(os.path.join(srcdir, 'jccl_rtrc.jar'), destdir) 1092 1121 1093 1122 srcdir = os.path.join(gJugglerDir, 'modules', 'jackal', 'plugins', 1094 1123 'corba_rtrc') 1095 s hutil.copy2(os.path.join(srcdir, 'jccl_rtrc.xml'), destdir)1124 smartCopy(os.path.join(srcdir, 'jccl_rtrc.xml'), destdir) 1096 1125 else: 1097 1126 printStatus("JCCL Java plug-ins not built. Skipping.") … … 1123 1152 srcroot = os.path.join(gJugglerDir, 'modules', 'sonix') 1124 1153 1125 s hutil.copy2(os.path.join(gJugglerDir, 'COPYING.txt'), destdir)1154 smartCopy(os.path.join(gJugglerDir, 'COPYING.txt'), destdir) 1126 1155 extra_files = ['ChangeLog', 'README.txt'] 1127 1156 for f in extra_files: 1128 s hutil.copy2(os.path.join(srcroot, f), destdir)1157 smartCopy(os.path.join(srcroot, f), destdir) 1129 1158 1130 1159 def installSonixPlugins(prefix, buildDir): … … 1184 1213 srcroot = os.path.join(gJugglerDir, 'modules', 'gadgeteer') 1185 1214 1186 s hutil.copy2(os.path.join(gJugglerDir, 'COPYING.txt'), destdir)1215 smartCopy(os.path.join(gJugglerDir, 'COPYING.txt'), destdir) 1187 1216 extra_files = ['ChangeLog', 'RELEASE_NOTES.txt'] 1188 1217 for f in extra_files: 1189 s hutil.copy2(os.path.join(srcroot, f), destdir)1218 smartCopy(os.path.join(srcroot, f), destdir) 1190 1219 1191 1220 def installGadgeteerDrivers(prefix, buildDir): … … 1267 1296 srcroot = os.path.join(gJugglerDir, 'modules', 'vrjuggler') 1268 1297 1269 s hutil.copy2(os.path.join(gJugglerDir, 'COPYING.txt'), destdir)1298 smartCopy(os.path.join(gJugglerDir, 'COPYING.txt'), destdir) 1270 1299 extra_files = ['ChangeLog', 'RELEASE_NOTES.txt'] 1271 1300 for f in extra_files: 1272 s hutil.copy2(os.path.join(srcroot, f), destdir)1301 smartCopy(os.path.join(srcroot, f), destdir) 1273 1302 1274 1303 def installVRJConfig(prefix, buildDir): … … 1311 1340 jar_file = os.path.join(jardir, j) 1312 1341 if os.path.exists(jar_file): 1313 s hutil.copy2(jar_file, destdir)1342 smartCopy(jar_file, destdir) 1314 1343 1315 1344 # Install the base set of VRJConfig JavaBeans. … … 1319 1348 jar_file = os.path.join(jardir, j) 1320 1349 if os.path.exists(jar_file): 1321 s hutil.copy2(jar_file, destdir)1322 1323 s hutil.copy2(os.path.join(vrjconfig_src, 'VRJConfig.xml'), destdir)1350 smartCopy(jar_file, destdir) 1351 1352 smartCopy(os.path.join(vrjconfig_src, 'VRJConfig.xml'), destdir) 1324 1353 1325 1354 # Install any custom editors that were compiled. … … 1331 1360 xml_file = os.path.join(custom_editor_src, e[0], e[1] + '.xml') 1332 1361 if os.path.exists(jar_file): 1333 s hutil.copy2(xml_file, destdir)1334 s hutil.copy2(jar_file, destdir)1362 smartCopy(xml_file, destdir) 1363 smartCopy(jar_file, destdir) 1335 1364 1336 1365 # Install any wizards that were compiled. … … 1340 1369 jar_file = os.path.join(jardir, e[1] + '.jar') 1341 1370 if os.path.exists(jar_file): 1342 s hutil.copy2(jar_file, destdir)1371 smartCopy(jar_file, destdir) 1343 1372 1344 1373 # Install vrjconfig.bat. 1345 1374 destdir = os.path.join(prefix, 'bin') 1346 s hutil.copy2(os.path.join(vrjconfig_src, 'vrjconfig.bat'), destdir)1375 smartCopy(os.path.join(vrjconfig_src, 'vrjconfig.bat'), destdir) 1347 1376 1348 1377 # Install dependencies. … … 1355 1384 destdir = os.path.join(prefix, 'share', 'vrjuggler', 'java') 1356 1385 for j in dep_jars: 1357 s hutil.copy2(os.path.join(srcroot, j), destdir)1386 smartCopy(os.path.join(srcroot, j), destdir) 1358 1387 else: 1359 1388 printStatus("VRJConfig not built. Skipping.") … … 1379 1408 destdir = os.path.join(prefix, 'share', 'vrjuggler', 'beans') 1380 1409 mkinstalldirs(destdir) 1381 s hutil.copy2(os.path.join(srcdir, name + '.jar'), destdir)1410 smartCopy(os.path.join(srcdir, name + '.jar'), destdir) 1382 1411 1383 1412 srcdir = os.path.join(gJugglerDir, 'modules', 'vrjuggler', 'plugins', 1384 1413 dir) 1385 s hutil.copy2(os.path.join(srcdir, name + '.xml'), destdir)1414 smartCopy(os.path.join(srcdir, name + '.xml'), destdir) 1386 1415 else: 1387 1416 printStatus("VR Juggler %s Java plug-ins not built. Skipping." % name) … … 1405 1434 1406 1435 for d in dlls: 1407 shutil.copy2(d, destdir) 1408 1409 shutil.copy2(os.path.join(sys_dir, 'dbghelp.dll'), destdir) 1436 smartCopy(d, pj(destdir,d)) 1437 1438 #smartCopy(d, pj(destdir,d)) 1439 smartCopy(os.path.join(sys_dir, 'dbghelp.dll'), destdir) 1410 1440 except KeyError, ex: 1411 1441 printStatus("WARNING: Could not install MSVC runtime DLLs") … … 1459 1489 def installBoost(prefix): 1460 1490 printStatus("Installing Boost headers and libraries") 1491 print "Installing Boost headers and libraries" 1461 1492 1462 1493 srcroot = os.environ['BOOST_ROOT'] … … 1473 1504 1474 1505 for f in lib_list: 1475 shutil.copy2(f, destdir) 1506 #print " ==> ", f 1507 smartCopy(f, destdir) 1476 1508 1477 1509 def installGMTL(prefix): … … 1496 1528 dll = os.path.join(d, 'OpenAL32.dll') 1497 1529 if os.path.exists(dll): 1498 s hutil.copy2(dll, destdir)1530 smartCopy(dll, destdir) 1499 1531 1500 1532 srcdir = os.environ['ALUT_ROOT'] … … 1505 1537 alut_dll = os.path.join(srcdir, 'lib', 'alut.dll') 1506 1538 if os.path.exists(alut_dll): 1507 s hutil.copy2(dll, destdir)1539 smartCopy(dll, destdir) 1508 1540 1509 1541 def installOmniORB(prefix):
