def _compile(self, install): # modify php.ini to add `geoip.custom_directory` self.load_config() self._php_ini.append_lines( 'geoip.custom_directory=@{HOME}/php/geoipdb/dbs') self._php_ini.save(self._php_ini_path) # download geoip dbs geoipdbs = os.path.join( self._ctx['BUILD_DIR'], 'php', 'geoipdb', 'dbs') utils.safe_makedirs(geoipdbs) if self._should_download(): print 'Downloading Geoip Databases.' stream_output(sys.stdout, self._build_download_cmd(), shell=True) self._link_geoip_dat() else: print 'Copying Geoip Databases from App.' app_geoipdbs = self._ctx.get(self.GEOIP_LOCATION_KEY, None) if app_geoipdbs: app_geoipdbs_path = os.path.join(self._ctx['BUILD_DIR'], app_geoipdbs) if not os.path.exists(app_geoipdbs_path): app_geoipdbs_path = os.path.join(self._ctx['BUILD_DIR'], 'htdocs', app_geoipdbs) shutil.rmtree(geoipdbs) shutil.move(app_geoipdbs_path, geoipdbs)
def test_find_composer_paths_not_in_vendor(self): tmpdir = None try: tmpdir = tempfile.mkdtemp(prefix="test_composer-") vendor = os.path.join(tmpdir, 'vendor') utils.safe_makedirs(vendor) with open(os.path.join(vendor, 'composer.json'), 'wt') as fp: fp.write("{}") (json_path, lock_path) = \ self.extension_module.find_composer_paths(tmpdir) assert json_path is None, "Found [%s]" % json_path assert lock_path is None, "Found [%s]" % lock_path finally: shutil.rmtree(tmpdir)