configurationengine/build-scripts/install_cone.py
changeset 5 d2c80f5cab53
parent 3 e7e0ae78773e
equal deleted inserted replaced
4:0951727b8815 5:d2c80f5cab53
   128     
   128     
   129     # Run easy_install to install the eggs
   129     # Run easy_install to install the eggs
   130     for egg in eggs:
   130     for egg in eggs:
   131         log.debug(egg)
   131         log.debug(egg)
   132         
   132         
   133         if PLATFORM_SUBDIR == 'win': 
   133         command = ['easy_install-%s' % python_version,
   134             command = ['easy_install-%s' % python_version,
   134                    '--find-links install-temp/dep-eggs',
   135                        '--allow-hosts None',
   135                    '--install-dir "%s"' % LIB_DIR,
   136                        '--find-links install-temp/dep-eggs',
   136                    '--script-dir "%s"' % SCRIPT_DIR,
   137                        '--install-dir "%s"' % LIB_DIR,
   137                    '--site-dirs "%s"' % LIB_DIR,
   138                        '--script-dir "%s"' % SCRIPT_DIR,
   138                    '--always-unzip']
   139                        '--site-dirs "%s"' % LIB_DIR,
   139         
   140                        '--always-copy',
   140         if PLATFORM_SUBDIR == 'win':
   141                        '--always-unzip']
   141             # Use --always-copy on Windows to copy all needed libraries
   142         else:
   142             command.append('--always-copy')
   143             command = ['easy_install-%s' % python_version,
   143         
   144                        '--allow-hosts None',
       
   145                        '--find-links install-temp/dep-eggs',
       
   146                        '--install-dir "%s"' % LIB_DIR,
       
   147                        '--script-dir "%s"' % SCRIPT_DIR,
       
   148                        '--site-dirs "%s"' % LIB_DIR,
       
   149                        '--always-unzip']
       
   150 
       
   151         command.append('"' + egg + '"')
   144         command.append('"' + egg + '"')
   152         command = ' '.join(command)
   145         command = ' '.join(command)
   153         
   146         
   154         log.debug(command)
   147         log.debug(command)
   155         ok = utils.run_command(command, env_overrides={'PYTHONPATH': LIB_DIR})
   148         ok = utils.run_command(command, env_overrides={'PYTHONPATH': LIB_DIR})
   163     orig_workdir = os.getcwd()
   156     orig_workdir = os.getcwd()
   164     try:
   157     try:
   165         for source_path in source_paths:
   158         for source_path in source_paths:
   166             os.chdir(source_path)
   159             os.chdir(source_path)
   167             command = ['%s setup.py develop' % python_executable,
   160             command = ['%s setup.py develop' % python_executable,
   168                    '--allow-hosts None',
       
   169                    '--find-links "%s"' % os.path.normpath(os.path.join(ROOT_PATH, 'install-temp/dep-eggs')),
   161                    '--find-links "%s"' % os.path.normpath(os.path.join(ROOT_PATH, 'install-temp/dep-eggs')),
   170                    '--install-dir "%s"' % LIB_DIR,
   162                    '--install-dir "%s"' % LIB_DIR,
   171                    '--script-dir "%s"' % SCRIPT_DIR,
   163                    '--script-dir "%s"' % SCRIPT_DIR,
   172                    '--site-dirs "%s"' % LIB_DIR,
   164                    '--site-dirs "%s"' % LIB_DIR,
   173                    '--always-copy']
   165                    ]
   174             command = ' '.join(command)
   166             command = ' '.join(command)
   175             log.debug(command)
   167             log.debug(command)
   176             ok = utils.run_command(command, env_overrides={'PYTHONPATH': LIB_DIR})
   168             ok = utils.run_command(command, env_overrides={'PYTHONPATH': LIB_DIR})
   177             if not ok:
   169             if not ok:
   178                 raise BuildFailedError()
   170                 raise BuildFailedError()
   185     log.info("Python version:    %s" % python_version)
   177     log.info("Python version:    %s" % python_version)
   186     log.info("Python executable: %s" % python_executable)
   178     log.info("Python executable: %s" % python_executable)
   187 
   179 
   188     # Retrieve dependencies to the correct location
   180     # Retrieve dependencies to the correct location
   189     retrieve_dep_eggs(plugin_package)
   181     retrieve_dep_eggs(plugin_package)
       
   182     
       
   183     # Install the dependencies locally using either local copies or downloading from PyPi
       
   184     deps = ['Jinja2', 'lxml']
       
   185     for dep in deps:
       
   186         command = ['easy_install-%s' % python_version,
       
   187                    '--find-links install-temp/dep-eggs']
       
   188 
       
   189         command.append(dep)
       
   190         command = ' '.join(command)
       
   191         log.debug(command)
       
   192         ok = utils.run_command(command)
       
   193         if not ok:
       
   194             print "Warning: failed to run easy_install to install %s." % dep
       
   195         
       
   196         
   190     
   197     
   191     # Find paths to the sources to install
   198     # Find paths to the sources to install
   192     source_paths = find_cone_egg_sources(plugin_package)
   199     source_paths = find_cone_egg_sources(plugin_package)
   193     
   200     
   194     log.info("Creating install directory...")
   201     log.info("Creating install directory...")