[ CLASS ] - Class to operate on Meco packages.
More...
|
def | __init__ (self, path=None) |
| Constructor. More...
|
|
def | __str__ (self) |
| String representation. More...
|
|
def | setPackage (self, path) |
| Set a package. More...
|
|
|
def | name (self) |
| Property. More...
|
|
def | version (self) |
| Property. More...
|
|
def | description (self) |
| Property. More...
|
|
def | keywords (self) |
| Property. More...
|
|
def | platforms (self) |
| Platforms. More...
|
|
def | documents (self) |
| Documents. More...
|
|
def | applications (self) |
| Applications. More...
|
|
def | pythonVersions (self) |
| Python versions. More...
|
|
def | isActive (self) |
| Property. More...
|
|
def | isExternal (self) |
| Property. More...
|
|
def | developers (self) |
| Property. More...
|
|
def | dependentPackages (self) |
| Property. More...
|
|
def | pythonPackages (self) |
| Property. More...
|
|
def | isVersioned (self) |
| Property. More...
|
|
def | path (self) |
| Property. More...
|
|
|
def | asStr (self) |
| Get string representation of the class. More...
|
|
def | asDict (self) |
| Get package information as a dict instance. More...
|
|
def | asHTML (self) |
| Get HTML representation of the package. More...
|
|
|
def | createPythonPackage (self, pythonPackageName) |
| Create a Python module for the given Python package. More...
|
|
def | createPythonModule (self, pythonModuleName, pythonPackageName=None) |
| Create a Python module for the given Python package of the package. More...
|
|
|
def | getPackageReleaseRelativePath (self) |
| Get relative release path of the package. More...
|
|
def | getReleaseFiles (self, relative=True) |
| Get files to be released. More...
|
|
|
def | getPythonPackages (self, ignoreDefault=False) |
| Get Python package names contained by this package. More...
|
|
def | getLocalDocument (self, folder) |
| Get absolute path of the requested local document. More...
|
|
def | getLineOfCode (self) |
| Get line of code contained by this package. More...
|
|
def | getFiles (self, folder, pythonPackageName=None, absPath=True, extension=None, suffix=None) |
| Get files for the requested local folder of the package. More...
|
|
def | runUnitTests (self, pythonPackageName=None) |
| Run unit tests of the package. More...
|
|
|
def | getLocation (self) |
| Get location of the packages, where this package belongs to. More...
|
|
def | getPythonPath (self) |
| Get the Python path of the package in PATH/PACKAGE_NAME/python format. More...
|
|
def | getPythonPackagePath (self, pythonPackageName=None) |
| Get the Python package path for given pythonPackageName in PATH/PACKAGE_NAME/python/PACKAGE_NAME format. More...
|
|
def | getLocalPath (self, relativePath) |
| Get absolute path of given relativePath of the package. More...
|
|
[ CLASS ] - Class to operate on Meco packages.
◆ __init__()
def mMecoPackage.packageLib.Package.__init__ |
( |
|
self, |
|
|
|
path = None |
|
) |
| |
Constructor.
- Parameters
-
path | [ str | None | in ] - Absolute path of an package info module. |
- Exceptions
-
- Returns
- None - None.
◆ __str__()
def mMecoPackage.packageLib.Package.__str__ |
( |
|
self | ) |
|
String representation.
- Exceptions
-
- Returns
- str - String representation.
◆ name()
def mMecoPackage.packageLib.Package.name |
( |
|
self | ) |
|
Property.
- Exceptions
-
- Returns
- str - Name.
◆ version()
def mMecoPackage.packageLib.Package.version |
( |
|
self | ) |
|
Property.
- Exceptions
-
- Returns
- str - Version.
◆ description()
def mMecoPackage.packageLib.Package.description |
( |
|
self | ) |
|
Property.
- Exceptions
-
- Returns
- str - Description.
◆ keywords()
def mMecoPackage.packageLib.Package.keywords |
( |
|
self | ) |
|
Property.
- Exceptions
-
- Returns
- list of str - Keywords.
◆ platforms()
def mMecoPackage.packageLib.Package.platforms |
( |
|
self | ) |
|
Platforms.
- Exceptions
-
- Returns
- list of str - Platforms.
◆ documents()
def mMecoPackage.packageLib.Package.documents |
( |
|
self | ) |
|
Documents.
- Exceptions
-
- Returns
- list of dict - Keys of dict instances are: title, url.
◆ applications()
def mMecoPackage.packageLib.Package.applications |
( |
|
self | ) |
|
Applications.
- Exceptions
-
- Returns
- list of str - Applications.
◆ pythonVersions()
def mMecoPackage.packageLib.Package.pythonVersions |
( |
|
self | ) |
|
Python versions.
- Exceptions
-
- Returns
- list of str - Python versions.
◆ isActive()
def mMecoPackage.packageLib.Package.isActive |
( |
|
self | ) |
|
Property.
- Exceptions
-
- Returns
- bool - Whether this package is active (in use).
◆ isExternal()
def mMecoPackage.packageLib.Package.isExternal |
( |
|
self | ) |
|
Property.
- Exceptions
-
- Returns
- bool - Whether this package is external.
◆ developers()
def mMecoPackage.packageLib.Package.developers |
( |
|
self | ) |
|
Property.
- Exceptions
-
- Returns
- list of str - Developers.
◆ dependentPackages()
def mMecoPackage.packageLib.Package.dependentPackages |
( |
|
self | ) |
|
Property.
- Exceptions
-
- Returns
- list of str - Dependent packages.
◆ pythonPackages()
def mMecoPackage.packageLib.Package.pythonPackages |
( |
|
self | ) |
|
Property.
- Exceptions
-
- Returns
- list of str - Python packages contained by this package.
◆ isVersioned()
def mMecoPackage.packageLib.Package.isVersioned |
( |
|
self | ) |
|
Property.
- Exceptions
-
- Returns
- bool - Result.
◆ path()
def mMecoPackage.packageLib.Package.path |
( |
|
self | ) |
|
Property.
- Exceptions
-
- Returns
- str - Path.
◆ setPackage()
def mMecoPackage.packageLib.Package.setPackage |
( |
|
self, |
|
|
|
path |
|
) |
| |
Set a package.
- Parameters
-
path | [ str | None | in ] - Absolute path of an package info module. |
- Exceptions
-
AttributeError | - If package info module doesn't have a required attribute. |
- Returns
- None - None.
◆ asStr()
def mMecoPackage.packageLib.Package.asStr |
( |
|
self | ) |
|
Get string representation of the class.
- Exceptions
-
- Returns
- str - Information about the package in human readable form.
◆ asDict()
def mMecoPackage.packageLib.Package.asDict |
( |
|
self | ) |
|
Get package information as a dict instance.
Keys of the returned dict instance are available in mMecoPackage.enumLib.PackageInfoModuleAttribute enum class. Additionally PATH
and IS_VERSIONED
keys are dynamically added to the returned dict instance.
- Exceptions
-
- Returns
- dict - Package information.
◆ asHTML()
def mMecoPackage.packageLib.Package.asHTML |
( |
|
self | ) |
|
Get HTML representation of the package.
This method provides information so it can be used on a GUI such as about dialog.
- Exceptions
-
- Returns
- str - Information about the package in human readable form in HTML format.
◆ createPythonPackage()
def mMecoPackage.packageLib.Package.createPythonPackage |
( |
|
self, |
|
|
|
pythonPackageName |
|
) |
| |
Create a Python module for the given Python package.
- Parameters
-
pythonPackageName | [ str | None | in ] - Name of the Python package under this package, which the Python module will be created for. |
- Exceptions
-
- Returns
- str - Absolute path of the created Python package in
PATH/PACKAGE_NAME/python/PYTHON_PACKAGE_NAME
format.
-
None - If no package has been set.
◆ createPythonModule()
def mMecoPackage.packageLib.Package.createPythonModule |
( |
|
self, |
|
|
|
pythonModuleName, |
|
|
|
pythonPackageName = None |
|
) |
| |
Create a Python module for the given Python package of the package.
- Parameters
-
pythonModuleName | [ str | None | in ] - Name of the Python module to be created. |
pythonPackageName | [ str | None | in ] - Name of the Python package under this package, which the Python module will be created in. |
- Exceptions
-
- Returns
- list of str - Absolute path of the created Python modules, first one is the module, second one is the unit test module.
-
None - If no package has been set.
◆ getPackageReleaseRelativePath()
def mMecoPackage.packageLib.Package.getPackageReleaseRelativePath |
( |
|
self | ) |
|
Get relative release path of the package.
This is the release destination path that includes the version.
Return format: PACKAGE_NAME/VERSION/PACKAGE_NAME
(i.e. mQtWidgets/1.4.8/mQtWidgets
)
- Exceptions
-
- Returns
- str - Relative path.
◆ getReleaseFiles()
def mMecoPackage.packageLib.Package.getReleaseFiles |
( |
|
self, |
|
|
|
relative = True |
|
) |
| |
Get files to be released.
- Parameters
-
relative | [ bool | True | in ] - Whether the file paths should be relative to root of the package. |
- Exceptions
-
- Returns
- list of str - Path of the files.
-
None - If no package has been set.
◆ getPythonPackages()
def mMecoPackage.packageLib.Package.getPythonPackages |
( |
|
self, |
|
|
|
ignoreDefault = False |
|
) |
| |
Get Python package names contained by this package.
Python packages are located in PATH/PACKAGE_NAME/python
folder.
- Parameters
-
ignoreDefault | [ bool | False | in ] - Whether to ignore default package, which is the package with the same name as this package. |
- Exceptions
-
- Returns
- list of str - Package names, empty if no package has been set.
◆ getLocalDocument()
def mMecoPackage.packageLib.Package.getLocalDocument |
( |
|
self, |
|
|
|
folder |
|
) |
| |
Get absolute path of the requested local document.
The following values can be provided as folder
.
- mMecoPackage.enumLib.FolderStructure.kDocCPPAPIReference
- mMecoPackage.enumLib.FolderStructure.kDocPythonAPIReference
- Parameters
-
folder | [ str | None | in ] - Document folder. |
- Exceptions
-
- Returns
- str - Absolute path of the help file.
-
None - If help file doesn't exist.
-
None - If no package has been set.
◆ getLineOfCode()
def mMecoPackage.packageLib.Package.getLineOfCode |
( |
|
self | ) |
|
Get line of code contained by this package.
- Exceptions
-
- Returns
- dict - Keys are, python and cpp.
-
None - If no package has been set.
◆ getFiles()
def mMecoPackage.packageLib.Package.getFiles |
( |
|
self, |
|
|
|
folder, |
|
|
|
pythonPackageName = None , |
|
|
|
absPath = True , |
|
|
|
extension = None , |
|
|
|
suffix = None |
|
) |
| |
Get files for the requested local folder of the package.
If mMecoPackage.enumLib.FolderStructure.kPython is provided for folder
argument, folder will be set as PATH/PACKAGE_NAME/python/PYTHON_PACKAGE_NAME
.
If no value provided for pythonPackageName
argument, name of the package will be used.
- Parameters
-
folder | [ str | None | in ] - Enum value from mMecoPackage.enumLib.FolderStructure. |
pythonPackageName | [ str | None | in ] - Name of the Python package. |
absPath | [ bool | True | in ] - Whether to list files with absolute path. |
extension | [ str | None | in ] - List files only with given extension. |
suffix | [ str | None | in ] - List files only with given suffix. |
- Exceptions
-
IOError | - If requested local folder doesn't exist. |
- Returns
- list of str - Files.
-
None - If no package has been set.
-
None - If no file is found.
◆ runUnitTests()
def mMecoPackage.packageLib.Package.runUnitTests |
( |
|
self, |
|
|
|
pythonPackageName = None |
|
) |
| |
Run unit tests of the package.
Return list contains a dict object for each unit test class. The dict instances contain the following data:
Key | Data Type | Description |
module | str | Absolute import path of the Python test module. |
class | str | Name of the unit test class. |
count | int | How many tests have been run. |
errors | list | Errors. |
failures | list | Failures. |
output | str | Output. |
If no value provided for pythonPackageName
argument, Python package with the same name as the package will be used.
- Parameters
-
pythonPackageName | [ str | None | in ] - Name of the Python package, which the tests will be run for. |
- Exceptions
-
- Returns
- list of dict - Result.
-
None - If no package has been set.
◆ getLocation()
def mMecoPackage.packageLib.Package.getLocation |
( |
|
self | ) |
|
Get location of the packages, where this package belongs to.
Since released packages have different path, this method can be used to get the packages path of the package. This is the path where all the packages will be under for any given environment.
- Exceptions
-
- Returns
- str - Absolute path of the location of the package.
-
None - If no package has been set.
◆ getPythonPath()
def mMecoPackage.packageLib.Package.getPythonPath |
( |
|
self | ) |
|
Get the Python path of the package in PATH/PACKAGE_NAME/python
format.
- Exceptions
-
- Returns
- str - Absolute path.
-
None - If no package has been set.
◆ getPythonPackagePath()
def mMecoPackage.packageLib.Package.getPythonPackagePath |
( |
|
self, |
|
|
|
pythonPackageName = None |
|
) |
| |
Get the Python package path for given pythonPackageName
in PATH/PACKAGE_NAME/python/PACKAGE_NAME
format.
If pythonPackageName
argument is not provided, name of the package will be used as Python package name.
- Parameters
-
pythonPackageName | [ str | None | in ] - Name of the Python package. |
- Exceptions
-
- Returns
- str - Absolute path.
-
None - If no package has been set.
-
None - If no Python package with given name contained by this package.
◆ getLocalPath()
def mMecoPackage.packageLib.Package.getLocalPath |
( |
|
self, |
|
|
|
relativePath |
|
) |
| |
Get absolute path of given relativePath
of the package.
Method doesn't check whether the returned path exists.
- Parameters
-
relativePath | [ str | None | in ] - Relative path. |
- Exceptions
-
- Returns
- str - Absolute path of the requested folder.
-
None - If no package has been set.
◆ getRootOfThisPackage()
def mMecoPackage.packageLib.Package.getRootOfThisPackage |
( |
| ) |
|
|
static |
Get the root of this particular package.
- Exceptions
-
- Returns
- str - Absolute path of the root of this package.
◆ isRootOfAPackage()
def mMecoPackage.packageLib.Package.isRootOfAPackage |
( |
|
path | ) |
|
|
static |
Check whether the given path is root of a package.
Following pattern will be checked: path/PACKAGE_NAME/python/PACKAGE_NAME/packageInfoLib.py
against given path
.
- Parameters
-
path | [ str | None | in ] - Path. |
- Exceptions
-
- Returns
- bool - Result.
◆ isInfoModuleFile()
def mMecoPackage.packageLib.Package.isInfoModuleFile |
( |
|
path | ) |
|
|
static |
Check whether given path is a package info module file.
Method first checks whether given path
exists.
- Parameters
-
path | [ str | None | in ] - Path. |
- Exceptions
-
- Returns
- str - Root path of the package, which given
path
(package info module file) belongs to.
-
None - If given
path
is not a package info module file or it doesn't exist.
◆ getPackageName()
def mMecoPackage.packageLib.Package.getPackageName |
( |
|
path | ) |
|
|
static |
Get package name from given package info module file path.
- Parameters
-
path | [ str | None | in ] - Package info module file path. |
- Exceptions
-
- Returns
- str - Name of the package.
-
None - If
path
doesn't belong to any package or path
doesn't exist.
◆ getInfoModuleFile()
def mMecoPackage.packageLib.Package.getInfoModuleFile |
( |
|
path | ) |
|
|
static |
Get package info module file path from given path.
- Parameters
-
path | [ str | None | in ] - Path, directory or file. |
- Exceptions
-
- Returns
- str - Absolute path of the package info module file.
-
None - If package info module file couldn't be found.
◆ getInfoModule()
def mMecoPackage.packageLib.Package.getInfoModule |
( |
|
path | ) |
|
|
static |
Get package info module from given path.
- Parameters
-
path | [ str | None | in ] - Path, directory or file. |
- Exceptions
-
- Returns
- str - Absolute path of the package info module file.
-
module - Imported package info module.
◆ getPackageByImport()
def mMecoPackage.packageLib.Package.getPackageByImport |
( |
|
name | ) |
|
|
static |
Import package and get Package
class instance that represents it.
- Parameters
-
name | [ str | None | in ] - Import name of the package. |
- Exceptions
-
- Returns
- mMecoPackage.packageLib.Package - Package class instance.
-
None - If no package with
name
available .
◆ list()
def mMecoPackage.packageLib.Package.list |
( |
| ) |
|
|
static |
List all packages.
Method searches packages by using sys.path
.
- Exceptions
-
- Returns
- list of module - Imported package info Python modules.
◆ create()
def mMecoPackage.packageLib.Package.create |
( |
|
name, |
|
|
|
description = '' , |
|
|
|
path = os.getcwd() , |
|
|
|
external = False |
|
) |
| |
|
static |
Create a package.
Method doesn't touch existing files.
- Parameters
-
name | [ str | None | in ] - Name of the package. |
description | [ str | None | in ] - Description about the package. |
path | [ str | None | in ] - Path, where the package will be created. |
external | [ bool | None | in ] - Whether this package should be marked external. |
- Exceptions
-
- Returns
- mMecoPackage.packageLib.Package - Package class instance.
The documentation for this class was generated from the following file: