def configure(ctx): exts = [] # include any existing extensions exts.extend(ctx.get('PHP_EXTENSIONS', [])) # add 'openssl' extension exts.append('openssl') # add platform extensions from composer.json & composer.lock (json_path, lock_path) = \ ComposerTool._find_composer_paths(ctx['BUILD_DIR']) if json_path: exts.extend(ComposerTool.read_exts_from_path(json_path)) if lock_path: exts.extend(ComposerTool.read_exts_from_path(lock_path)) # update context with new list of extensions, if composer.json exists if json_path or lock_path: if json_path: php_version = \ ComposerTool.read_php_version_from_composer_json(json_path) else: php_version = \ ComposerTool.read_php_version_from_composer_lock(lock_path) _log.debug('Composer picked PHP Version [%s]', php_version) ctx['PHP_VERSION'] = ComposerTool.pick_php_version(ctx, php_version) ctx['PHP_EXTENSIONS'] = utils.unique(exts)
def configure(ctx): exts = [] # include any existing extensions exts.extend(ctx.get('PHP_EXTENSIONS', [])) # add 'openssl' extension exts.append('openssl') # add platform extensions from composer.json & composer.lock (json_path, lock_path) = \ ComposerTool._find_composer_paths(ctx['BUILD_DIR']) if json_path: exts.extend(ComposerTool.read_exts_from_path(json_path)) if lock_path: exts.extend(ComposerTool.read_exts_from_path(lock_path)) # update context with new list of extensions, if composer.json exists if json_path or lock_path: if json_path: php_version = \ ComposerTool.read_php_version_from_composer_json(json_path) else: php_version = \ ComposerTool.read_php_version_from_composer_lock(lock_path) _log.debug('Composer picked PHP Version [%s]', php_version) ctx['PHP_VERSION'] = ComposerTool.pick_php_version( ctx, php_version) ctx['PHP_EXTENSIONS'] = utils.unique(exts)
def test_order_is_the_same(self): x = [6, 5, 7, 6, 8, 9, 2, 2, 7, 5, 1, 9, 1, 6, 7, 0] y = utils.unique(x) assert len(y) == 8 assert y[0] == 6 assert y[1] == 5 assert y[2] == 7 assert y[3] == 8 assert y[4] == 9 assert y[5] == 2 assert y[6] == 1 assert y[7] == 0
def configure(self): if self.json_path or self.lock_path: exts = [] # include any existing extensions exts.extend(self._ctx.get('PHP_EXTENSIONS', [])) # add 'openssl' extension exts.append('openssl') # add platform extensions from composer.json & composer.lock exts.extend(self.read_exts_from_path(self.json_path)) exts.extend(self.read_exts_from_path(self.lock_path)) # update context with new list of extensions, # if composer.json exists php_version = self.read_version_from_composer('php') self._log.debug('Composer picked PHP Version [%s]', php_version) self._ctx['PHP_VERSION'] = self.pick_php_version(php_version) self._ctx['PHP_EXTENSIONS'] = utils.unique(exts) self._ctx['PHP_VM'] = 'php'
def configure(self): if self.json_path or self.lock_path: exts = [] # include any existing extensions exts.extend(self._ctx.get('PHP_EXTENSIONS', [])) # add 'openssl' extension exts.append('openssl') # add platform extensions from composer.json & composer.lock exts.extend(self.read_exts_from_path(self.json_path)) exts.extend(self.read_exts_from_path(self.lock_path)) # update context with new list of extensions, # if composer.json exists php_version = self.read_version_from_composer('php') self._log.debug('Composer picked PHP Version [%s]', php_version) self._ctx['PHP_VERSION'] = self.pick_php_version(php_version) self._ctx['PHP_EXTENSIONS'] = utils.unique(exts) self._ctx['PHP_VM'] = 'php'
def test_all_dups(self): x = [1, 1, 1, 1, 1, 1, 1] y = utils.unique(x) assert len(y) == 1 assert y[0] == 1
def test_no_change(self): x = [6, 5, 7, 8, 9, 3, 2, 1] y = utils.unique(x) assert len(x) == len(y) assert [a == b for a, b in zip(x, y)]