use of org.python.pydev.core.ISystemModulesManager in project Pydev by fabioz.
the class ProjectModulesManager method getBuiltins.
/**
* @see org.python.pydev.core.IProjectModulesManager#getBuiltins()
*/
@Override
public String[] getBuiltins() {
String[] builtins = null;
ISystemModulesManager systemModulesManager = getSystemModulesManager();
if (systemModulesManager != null) {
builtins = systemModulesManager.getBuiltins();
}
return builtins;
}
use of org.python.pydev.core.ISystemModulesManager in project Pydev by fabioz.
the class CompiledModule method getCached.
/**
* Gets cached information for the given name. Could be a dotted or non-dotted name.
*/
private static Tuple<File, IToken[]> getCached(String name, IModulesManager manager) {
ISystemModulesManager systemModulesManager = manager.getSystemModulesManager();
File f = getCacheFile(name, systemModulesManager);
if (f != null && f.exists()) {
try {
IToken[] toks = null;
File file = null;
try (FileInputStream fin = new FileInputStream(f)) {
try (InputStream in = new BufferedInputStream(new GZIPInputStream(fin))) {
try (ObjectInputStream stream = new ObjectInputStream(in)) {
ObjectsInternPool.ObjectsPoolMap map = new ObjectsInternPool.ObjectsPoolMap();
@SuppressWarnings("unused") Object // we already have the name set (so, it's only there for completeness).
_name = stream.readObject();
file = (File) stream.readObject();
int size = stream.readInt();
toks = new IToken[size];
IPythonNature nature = systemModulesManager.getNature();
for (int i = 0; i < size; i++) {
// Note intern (we probably have many empty strings -- or the same for parentPackage)
String rep = ObjectsInternPool.internLocal(map, (String) stream.readObject());
int type = stream.readInt();
String args = ObjectsInternPool.internLocal(map, (String) stream.readObject());
String parentPackage = ObjectsInternPool.internLocal(map, (String) stream.readObject());
toks[i] = new CompiledToken(rep, "", args, parentPackage, type, nature);
}
for (int i = 0; i < size; i++) {
toks[i].setDocStr(ObjectsInternPool.internLocal(map, (String) stream.readObject()));
}
}
}
}
return new Tuple<File, IToken[]>(file, toks);
} catch (Exception e) {
// Unable to read: just log it
Log.log("Unable to read contents from: " + f, e);
}
}
return null;
}
use of org.python.pydev.core.ISystemModulesManager in project Pydev by fabioz.
the class InterpreterGroup method calculateChildren.
@Override
protected void calculateChildren() {
Iterator<String> forcedLibsIterator = this.interpreterInfo.forcedLibsIterator();
while (forcedLibsIterator.hasNext()) {
addChild(new ForcedLibGroup(this, this.interpreterInfo, forcedLibsIterator.next()));
}
ISystemModulesManager modulesManager = this.interpreterInfo.getModulesManager();
Set<String> allModuleNames = modulesManager.getAllModuleNames(false, "");
for (String moduleName : allModuleNames) {
addChild(new LeafElement(this, moduleName));
}
}
use of org.python.pydev.core.ISystemModulesManager in project Pydev by fabioz.
the class InterpreterInfoBuilder method syncInfoToPythonPath.
public BuilderResult syncInfoToPythonPath(IProgressMonitor monitor, InterpreterInfo info, AbstractAdditionalDependencyInfo additionalInfo) {
ISystemModulesManager modulesManager = info.getModulesManager();
PythonPathHelper pythonPathHelper = (PythonPathHelper) modulesManager.getPythonPathHelper();
if (pythonPathHelper == null) {
// Is this even possible?
pythonPathHelper = new PythonPathHelper();
}
// Just making sure it's consistent at this point.
pythonPathHelper.setPythonPath(info.libs);
return this.syncInfoToPythonPath(monitor, pythonPathHelper, additionalInfo, modulesManager, info);
}
use of org.python.pydev.core.ISystemModulesManager in project Pydev by fabioz.
the class InterpreterInfoBuilder method syncInfoToPythonPath.
@Override
public BuilderResult syncInfoToPythonPath(IProgressMonitor monitor, InterpreterInfo info) {
ISystemModulesManager modulesManager = info.getModulesManager();
IInterpreterManager manager = modulesManager.getInterpreterManager();
AbstractAdditionalDependencyInfo additionalInfo;
try {
additionalInfo = AdditionalSystemInterpreterInfo.getAdditionalSystemInfo(manager, info.getExecutableOrJar());
} catch (MisconfigurationException e) {
Log.log(e);
return BuilderResult.OK;
}
return this.syncInfoToPythonPath(monitor, info, additionalInfo);
}
Aggregations