Inject requirements into packaged application.
@return {Promise} the combined promise for requirements injection.
979335
function injectAllRequirements(funcArtifact) {
  if (this.options.layer) {
    // The requirements will be placed in a Layer, so just resolve
    return BbPromise.resolve();
  }

  this.serverless.cli.log('Injecting required Python packages to package...');

  if (this.serverless.service.package.individually) {
    return BbPromise.resolve(this.targetFuncs)
      .filter(func =>
        (func.runtime || this.serverless.service.provider.runtime).match(
          /^python.*/
        )
      )
      .map(func => {
        if (!get(func, 'module')) {
          set(func, ['module'], '.');
        }
        return func;
      })
      .map(func => {
        if (func.module !== '.') {
          const artifact = func.package ? func.package.artifact : funcArtifact;
          const newArtifact = path.join(
            '.serverless',
            `${func.module}-${func.name}.zip`
          );
          func.package.artifact = newArtifact;
          return moveModuleUp(artifact, newArtifact, func.module).then(
            () => func
          );
        } else {
          return func;
        }
      })
      .map(func => {
        return this.options.zip
          ? func
          : injectRequirements(
              path.join('.serverless', func.module, 'requirements'),
              func.package.artifact,
              this.options
            );
      });
  } else if (!this.options.zip) {
    return injectRequirements(
      path.join('.serverless', 'requirements'),
      this.serverless.service.package.artifact || funcArtifact,
      this.options
    );
  }
}
867859
function installRequirements(done) {
  var _calls = [];
  _.forEach(REQUIRED_INSTALLS, function(npmName) {
    _calls.push(function(done) {
      return Crux.util.install.npm(npmName, done, false);
    });
  });
  async.waterfall(_calls, done);
}
628892
function () {
	    	var deferred = $q.defer();
	    	var promise = deferred.promise;
            
            function ok(value){
                deferred.resolve(value);
            }
            
            function errorCallback(error){
                deferred.reject(new Error(error));
            }
            
            if($window.plugins){
                $window.plugins.appPreferences.show()
                    .then(ok, errorCallback);
            } else {
                deferred.reject(new Error(this.pluginNotEnabledMessage));
            }
	    	
	    	this.decoratePromise(promise);
	    	return promise;
	    }
1230339
function execDependencyInstall () {

	console.log('\nExecuting npm install command...');

	return new Promise(function(resolve, reject){

		var child = require('child_process').spawn('npm', ['install'], {
			cwd: process.cwd,
			detached: false,
			env: process.env,
			stdio: [process.stdin, process.stdout, process.stderr]
		});

		child.on('error', function (error) {
			console.error(colors.bold.red('ERROR: Could not install the required modules:'));
			console.error(error.stack.toString());
			process.exit(255);
		});

		child.on('close', function (exit_code) {
			if (exit_code !== 0) {
				console.error(colors.bold.red('\nERROR: npm install has been failed.'));
				process.exit(255);
			}
			console.log('\nnpm install has been completed.\n\n');
			resolve(true);
		});

	});

}
420994
def add_require(self, require):
        
        for p in self.requires:
            if p.value == require.value:
                return
        self.requires.append(require)
157293
def get_requirements(
            self, install=True, extras=True, setup=False, tests=False):
        """"""
        requires = []
        if install:
            requires.extend(parse_requirements(
                self.keywords.get('install_requires', ()),
            ))
        if extras:
            for r in self.keywords.get('extras_require', {}).values():
                requires.extend(parse_requirements(r))
        if setup:
            requires.extend(parse_requirements(
                self.keywords.get('setup_requires', ()),
            ))
        if tests:
            requires.extend(parse_requirements(
                self.keywords.get('tests_require', ()),
            ))
        return requires
596990
function injectDependencies(serviceLoader) {

    var EventEmitter = require('events').EventEmitter;
    serviceLoader.inject('events', new EventEmitter());

    //inject itself so that services can directly use the service loader
    serviceLoader.inject('serviceLoader', serviceLoader);

    //app will be injected by middleware, so this is a placeholder to force our dependency calculations to be correct
    serviceLoader.inject('app', {}, ['middleware']);
}
691447
function getAllPackages () {
  const packages = [
    // main package
    {
      entry: config.entry,
      jsName: 'index',
      cssName: 'style',
      globName: config.fullname,
      amdName: config.name,
    },
  ]

  return Promise.all([
    packagesFromPath(utils.resolve('src/component'), utils.resolve('src/component')),
    packagesFromPath(utils.resolve('src/mixin'), srcPath),
    packagesFromPath(utils.resolve('src/ol-ext'), srcPath),
    packagesFromPath(utils.resolve('src/rx-ext'), srcPath),
    packagesFromPath(utils.resolve('src/util'), srcPath),
  ]).then(otherPackages => {
    return packages.concat(otherPackages.reduce((all, packages) => all.concat(packages), []))
  })
}
1220063
function(context, pkg){
		var deps = crawl.getDependencyMap(context.loader, pkg, true);

		var pluginsPromise = crawl.loadPlugins(context, pkg, true, deps, true);
		var stealPromise = crawl.loadSteal(context, pkg, true, deps);

		return Promise.all([pluginsPromise, stealPromise]);
	}
514760
function createImportPromise(loader, name, promise) {
    var importPromises = loader._loader.importPromises;
    return importPromises[name] = promise.then(function(m) {
      importPromises[name] = undefined;
      return m;
    }, function(e) {
      importPromises[name] = undefined;
      throw e;
    });
  }
1079344
public static function includeRequirements()
    {
        $debugbar = self::getDebugBar();

        if (!$debugbar) {
            return;
        }

        // Already called
        if (self::$renderer) {
            return;
        }

        $renderer = $debugbar->getJavascriptRenderer();

        // We don't need the true path since we are going to use Requirements API that appends the BASE_PATH
        $assetsResource = self::moduleResource('assets');
        $renderer->setBasePath($assetsResource->getRelativePath());
        $renderer->setBaseUrl(Director::makeRelative($assetsResource->getURL()));

        $includeJquery = self::config()->get('include_jquery');
        // In CMS, jQuery is already included
        if (self::isAdminController()) {
            $includeJquery = false;
        }
        // If jQuery is already included, set to false
        $js = Requirements::backend()->getJavascript();
        foreach ($js as $url => $args) {
            $name = basename($url);
            if ($name == 'jquery.js' || $name == 'jquery.min.js') {
                $includeJquery = false;
                break;
            }
        }

        if ($includeJquery) {
            $renderer->setEnableJqueryNoConflict(true);
        } else {
            $renderer->disableVendor('jquery');
            $renderer->setEnableJqueryNoConflict(false);
        }

        if (DebugBar::config()->get('enable_storage')) {
            $renderer->setOpenHandlerUrl('__debugbar');
        }

        foreach ($renderer->getAssets('css') as $cssFile) {
            Requirements::css(Director::makeRelative(ltrim($cssFile, '/')));
        }

        foreach ($renderer->getAssets('js') as $jsFile) {
            Requirements::javascript(Director::makeRelative(ltrim($jsFile, '/')));
        }

        self::$renderer = $renderer;
    }
20255
def install_package_requirements(self, psrc, stream_output=None):
        
        package = self.target + '/' + psrc
        assert isdir(package), package
        reqname = '/requirements.txt'
        if not exists(package + reqname):
            reqname = '/pip-requirements.txt'
            if not exists(package + reqname):
                return
        return self.user_run_script(
            script=scripts.get_script_path('install_reqs.sh'),
            args=['/project/' + psrc + reqname],
            rw_venv=True,
            rw_project=True,
            stream_output=stream_output
            )
1026911
function (requestPromise) {
  var that = this;

  // this will be bound to Client instance later in the Client constructor
  if (!this.isValid) {
    return Promise.reject(new Model({Errors: this.errors.join(',')}));
  }

  return requestPromise.apply(null, slice.call(arguments, 1))
    .then(function (response) {
      return new Model(response);
    }, function (reason) {
      var errors = that.errors;
      if (reason.statusCode >= 400 && reason.statusCode < 500) {
        errors.push(ClientError.HTTP_CLIENT_ERROR);
      } else if (reason.statusCode >= 500 && reason.statusCode < 600) {
        errors.push(ClientError.HTTP_SERVER_ERROR);
      } else {
        errors.push(ClientError.EXCEPTION);
      }
      return Promise.reject(new Model({Errors: errors.join(',')}));
    });
}
1297280
function() {
        return new Promise(function(resolve, reject) {
            try {
                let files;
                if(fileUtils.fileExists(resourceDir)) {
                    files = fs.readdirSync(resourceDir);
                    files = _.uniqBy(files, function (f) {
                        return path.basename(f, '.' + rc.tools.spec.file_ext);
                    }).map(function(f) { return path.join(resourceDir, f);});
                }
                if(!files) files = [];
                resolve(files);
            } catch (err) {
                reject(err);
            }
        }).then(function(files) {
            return promiseUtils.chain(rc.tools.inspect, function(err) {
                console.error(err);
                return false;
            })(files);
        });
    }
925806
function inject(moduleName) {
                    var localParams = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
                    var real = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2];

                    var self = this,
                        deferred = $q.defer();
                    if (angular.isDefined(moduleName) && moduleName !== null) {
                        if (angular.isArray(moduleName)) {
                            var promisesList = [];
                            angular.forEach(moduleName, function (module) {
                                promisesList.push(self.inject(module, localParams, real));
                            });
                            return $q.all(promisesList);
                        } else {
                            self._addToLoadList(self._getModuleName(moduleName), true, real);
                        }
                    }
                    if (modulesToLoad.length > 0) {
                        var res = modulesToLoad.slice(); // clean copy
                        var loadNext = function loadNext(moduleName) {
                            moduleCache.push(moduleName);
                            modulePromises[moduleName] = deferred.promise;
                            self._loadDependencies(moduleName, localParams).then(function success() {
                                try {
                                    justLoaded = [];
                                    _register(providers, moduleCache, localParams);
                                } catch (e) {
                                    self._$log.error(e.message);
                                    deferred.reject(e);
                                    return;
                                }

                                if (modulesToLoad.length > 0) {
                                    loadNext(modulesToLoad.shift()); // load the next in list
                                } else {
                                        deferred.resolve(res); // everything has been loaded, resolve
                                    }
                            }, function error(err) {
                                deferred.reject(err);
                            });
                        };

                        // load the first in list
                        loadNext(modulesToLoad.shift());
                    } else if (localParams && localParams.name && modulePromises[localParams.name]) {
                        return modulePromises[localParams.name];
                    } else {
                        deferred.resolve();
                    }
                    return deferred.promise;
                }
1145712
function (plugin){
      if (Utils.isObject(plugin) && Utils.isFunction(plugin.install)) {
        var installArgs = [];

        // Inject plugin dependencies as requested, using the synchronous
        // require API for Require.js and Almond.js.
        if(plugin.$inject){
          plugin.$inject.forEach(function (dependency) {
            installArgs.push(require(dependency));
          });
        }

        plugin.install.apply(plugin, installArgs);

        return this;
      } else {
        throw new TypeError('Plugin must implement \'install()\' method.');
      }
    }
186860
function prepare(options) {
  return Promise.all([prepareHelpers(options), preparePartials(options)]).then(
    () => options,
    error => DrizzleError.error(error, options.debug)
  );
}