26#include <qabstractitemmodel.h>
29#include "../common/sharedStructures.h"
36 enum Status {Unknown, Uptodate, Outdated};
37 PythonPackage() : m_status(Unknown), m_detailsFetched(
false) {};
39 m_name(name), m_version(version), m_location(
""), m_requires(
""), m_status(Unknown), m_newVersion(
""), m_detailsFetched(
false)
50 bool m_detailsFetched;
55 PipGeneralOptions() : isolated(
false), logPath(
""), proxy(
""), timeout(15), retries(5), useTrustedHosts(
false) {}
62 QStringList trustedHosts;
97 taskFetchPackagesDetails,
101 taskVerifyInstalledPackages
113 QVariant
data(
const QModelIndex &
index,
int role)
const;
114 QVariant
headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole)
const;
115 QModelIndex
index(
int row,
int column,
const QModelIndex &
parent = QModelIndex())
const;
116 QModelIndex
parent(
const QModelIndex &
index)
const;
120 void startPipProcess();
121 bool isPipStarted()
const;
122 inline int getPipVersion()
const {
return m_pipVersion; }
124 void checkPipAvailable(
const PipGeneralOptions &options = PipGeneralOptions());
125 void listAvailablePackages(
const PipGeneralOptions &options = PipGeneralOptions(),
bool forceReloadDetails =
false);
126 void checkPackageUpdates(
const PipGeneralOptions &options = PipGeneralOptions());
127 void checkVerifyInstalledPackages(
const PipGeneralOptions &options = PipGeneralOptions());
128 void installPackage(
const PipInstall &installSettings,
const PipGeneralOptions &options = PipGeneralOptions());
129 void uninstallPackage(
const QString &packageName,
bool runAsSudo,
const PipGeneralOptions &options = PipGeneralOptions());
132 void interruptPipProcess();
134 bool isPackageInUseByOther(
const QModelIndex &
index);
138 QStringList parseGeneralOptions(
const PipGeneralOptions &options,
bool ignoreRetries =
false,
bool ignoreVersionCheck =
true)
const;
147 QProcess m_pipProcess;
149 QByteArray m_standardOutputBuffer;
150 QByteArray m_standardErrorBuffer;
153 QString m_pythonPath;
155 wchar_t *m_pUserDefinedPythonHome;
159 int m_numberOfUnfetchedPackageDetails;
160 int m_numberOfNewlyObtainedPackageDetails;
161 bool m_fetchDetailCancelRequested;
163 void fetchPackageDetails(
const QStringList& names,
int totalNumberOfUnfetchedDetails,
bool firstCall);
164 void updatePythonPackageDetails(
const PythonPackage& details);
165 bool triggerFetchDetailsForOpenPackages(
bool firstCall);
167 void finalizeTask(
int exitCode = 0);
168 void finalizeTaskCheckAvailable(
const QString& error,
const QString& output,
int exitCode);
169 void finalizeTaskListPackages(
const QString& error,
const QString& output);
170 void finalizeTaskFetchPackagesDetails(
const QString& error,
const QString& output);
171 void finalizeTaskCheckUpdates(
const QString& error,
const QString& output);
172 void finalizeTaskVerifyInstalledPackages(
const QString& error,
const QString& output);
173 void finalizeTaskInstall(
const QString& error,
const QString& output);
174 void finalizeTaskUninstall(
const QString& error,
const QString& output);
177 void processError(QProcess::ProcessError error);
178 void processFinished(
int exitCode, QProcess::ExitStatus exitStatus);
179 void processReadyReadStandardError();
180 void processReadyReadStandardOutput();
183 void pipManagerBusy();
184 void outputAvailable(
const QString &text,
bool success);
185 void pipVersion(
const QString &version);
186 void pipRequestStarted(
const PipManager::Task &task,
const QString &text,
bool outputSilent =
false);
187 void pipRequestFinished(
const PipManager::Task &task,
const QString &text,
bool success);
188 void pipFetchDetailsProgress(
int totalNumberOfUnfetchedDetails,
int recentlyFetchedDetails,
bool finished);
Definition pipManager.h:86
ito::RetVal checkCallMode()
check if pip can be called via the itom-packages/pipProcess/runPipUtf8.py script or directly
Definition pipManager.cpp:417
QList< QVariant > m_alignment
list of alignments for the corresponding headers
Definition pipManager.h:145
QList< QString > m_headers
string list of names of column headers
Definition pipManager.h:144
void startProcess(const QStringList &arguments)
the arguments string list must not contain -m as first entry.
Definition pipManager.cpp:584
QString m_runPipUtf8Path
only valid if m_pipCallMode == pipModeRunPipUtf8
Definition pipManager.h:157
PipManager(ito::RetVal &retval, QObject *parent=0)
Definition pipManager.cpp:44
~PipManager()
Definition pipManager.cpp:168
QVariant data(const QModelIndex &index, int role) const
Definition pipManager.cpp:493
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
Definition pipManager.cpp:567
int rowCount(const QModelIndex &parent=QModelIndex()) const
Definition pipManager.cpp:462
QList< PythonPackage > m_pythonPackages
list with installed python packages
Definition pipManager.h:146
QModelIndex parent(const QModelIndex &index) const
Definition pipManager.cpp:452
int columnCount(const QModelIndex &parent=QModelIndex()) const
Definition pipManager.cpp:553
PipMode
Definition pipManager.h:104
@ pipModeDirect
directly call pip as process (might cause encoding errors under windows)
Definition pipManager.h:106
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
Definition pipManager.cpp:471
Class for managing status values (like errors or warning)
Definition retVal.h:54
Definition apiFunctionsGraph.cpp:40
Definition pipManager.h:54
Definition pipManager.h:66
Definition pipManager.h:35