Changeset 68

Show
Ignore:
Timestamp:
05/01/07 17:02:18 (6 years ago)
Author:
jjr8
Message:

Final checkin to fix #51. The Python packages now install properly on systems that have Arc 9.1 or 9.2. I performed minimal testing on Arc 9.2.

Location:
MGET/Trunk
Files:
1 removed
3 modified

Legend:

Unmodified
Added
Removed
  • MGET/Trunk/PythonPackage/setup.py

    r61 r68  
    375375        # Copy in binaries written by GeoEco developers. 
    376376 
    377         shutil.copyfile(os.path.join(setupDir, u'..', u'VisualStudioSolutions', u'RegisterToolboxWithArcCatalog', u'bin', u'Release', u'RegisterToolboxWithArcCatalog.exe'), os.path.join(arcGISDir, u'Bin', u'RegisterToolboxWithArcCatalog.exe')) 
     377        shutil.copyfile(os.path.join(setupDir, u'..', u'VisualStudioSolutions', u'RegisterToolboxWithArcCatalog91', u'bin', u'Release', u'RegisterToolboxWithArcCatalog91.exe'), os.path.join(arcGISDir, u'Bin', u'RegisterToolboxWithArcCatalog91.exe')) 
     378        shutil.copyfile(os.path.join(setupDir, u'..', u'VisualStudioSolutions', u'RegisterToolboxWithArcCatalog92', u'bin', u'Release', u'RegisterToolboxWithArcCatalog92.exe'), os.path.join(arcGISDir, u'Bin', u'RegisterToolboxWithArcCatalog92.exe')) 
    378379 
    379380        # Ensure these files are provided to distutils. 
     
    596597 
    597598    # Ensure the ArcGIS is installed by reading the InstallDir from the registry. 
     599    # Also read the ArcGIS version, so we can determine which version of 
     600    # RegisterToolboxWithArcCatalog we need to run. 
    598601 
    599602    try: 
     
    601604        try: 
    602605            (arcGISInstallDir, installDirType) = win32api.RegQueryValueEx(hkey, 'InstallDir') 
     606            (realVersion, realVersionType) = win32api.RegQueryValueEx(hkey, 'RealVersion') 
    603607        finally: 
    604608            try: 
     
    619623    # Run RegisterToolboxWithArcCatalog.exe. 
    620624 
    621     args = [os.path.join(geoEcoRoot, 'ArcGISToolbox', 'Bin', 'RegisterToolboxWithArcCatalog.exe'), 
     625    if str(realVersion) == '9.1': 
     626        executable = 'RegisterToolboxWithArcCatalog91.exe' 
     627    else: 
     628        executable = 'RegisterToolboxWithArcCatalog92.exe' 
     629 
     630    args = [os.path.join(geoEcoRoot, 'ArcGISToolbox', 'Bin', executable), 
    622631            action, 
    623632            os.path.join(geoEcoRoot, 'ArcGISToolbox', 'Marine Geospatial Ecology Tools.tbx')] 
     
    627636    except Exception, e: 
    628637        if action == 'register': 
    629             print('WARNING: Failed to add the ArcGIS toolbox to ArcCatalog. When attempting to start the toolbox registration program "%s register \\'%s\\'", Python reported an error: %s' % (os.path.join(geoEcoRoot, 'ArcGISToolbox', 'Bin', 'RegisterToolboxWithArcCatalog.exe'), os.path.join(geoEcoRoot, 'ArcGISToolbox', 'Marine Geospatial Ecology Tools.tbx'), str(e).strip())) 
     638            print('WARNING: Failed to add the ArcGIS toolbox to ArcCatalog. When attempting to start the toolbox registration program "%s register \\'%s\\'", Python reported an error: %s' % (os.path.join(geoEcoRoot, 'ArcGISToolbox', 'Bin', executable), os.path.join(geoEcoRoot, 'ArcGISToolbox', 'Marine Geospatial Ecology Tools.tbx'), str(e).strip())) 
    630639            print('') 
    631640            print('You can manually add the toolbox to ArcCatalog from this location:') 
     
    640649    if retcode != 0: 
    641650        if action == 'register': 
    642             print('WARNING: Failed to add the ArcGIS toolbox to ArcCatalog. The toolbox registration program "%s register \\'%s\\'" reported: %s' % (os.path.join(geoEcoRoot, 'ArcGISToolbox', 'Bin', 'RegisterToolboxWithArcCatalog.exe'), os.path.join(geoEcoRoot, 'ArcGISToolbox', 'Marine Geospatial Ecology Tools.tbx'), p.stderr.read().strip())) 
     651            print('WARNING: Failed to add the ArcGIS toolbox to ArcCatalog. The toolbox registration program "%s register \\'%s\\'" reported: %s' % (os.path.join(geoEcoRoot, 'ArcGISToolbox', 'Bin', executable), os.path.join(geoEcoRoot, 'ArcGISToolbox', 'Marine Geospatial Ecology Tools.tbx'), p.stderr.read().strip())) 
    643652            print('') 
    644653            print('You can manually add the toolbox to ArcCatalog from this location:')