ostool

Module for platform specific operations

There are 3 important parts:

jukeboxcore.ostool.detect_sys() detects the platform you are working on.

jukeboxcore.ostool.PlatformInterface is an abstract class that defines a set of methods To support a special plattform, subclass it and implement the abstract methods. Then put your Class inside jukeboxcore.ostool.interfaces. The system should be the key for the dict.

jukeboxcore.ostool.get_interface() will detect your system, then searches inside jukeboxcore.ostool.interfaces for a match.

jukeboxcore.ostool.detect_sys()[source]

Tries to identify your python platform

Returns:a dict with the gathered information
Return type:dict
Raises:None

the returned dict has these keys: ‘system’, ‘bit’, ‘compiler’, ‘python_version_tuple’

eg.:

{'system':'Windows', 'bit':'32bit', 'compiler':'MSC v.1500 32bit (Intel)', 'python_version_tuple':('2', '7', '6')}
class jukeboxcore.ostool.PlatformInterface[source]

Bases: object

An abstract class that has platform specific methods

Sublcasses have to implement those methods!

get_maya_location()[source]

Return the installation path to maya

Returns:path to maya
Return type:str
Raises:errors.SoftwareNotFoundError
get_maya_sitepackage_dir()[source]

Return the sitepackage dir for maya

Returns:path to the maya sitepackages
Return type:str
Raises:errors.SoftwareNotFoundError
get_maya_bin()[source]

Return the path to the maya bin dir

Returns:path to maya bin dir
Return type:str
Raises:errors.SoftwareNotFoundError
get_maya_python()[source]

Return the path to the mayapy executable

Returns:path to the maya python intepreter
Return type:str
Raises:errors.SoftwareNotFoundError
get_maya_exe()[source]

Return the path to the maya executable

Returns:path to the maya exe
Return type:str
Raises:errors.SoftwareNotFoundError
get_maya_envpath()[source]

Return the PYTHONPATH neccessary for running mayapy

Returns:the PYTHONPATH that is used for running mayapy
Return type:str
Raises:None
open_path(path)[source]

Open the given path in the file browser

Parameters:path (str) – the path to open
Returns:None
Return type:None
Raises:None
class jukeboxcore.ostool.WindowsInterface[source]

Bases: jukeboxcore.ostool.PlatformInterface

Interface for all windows related operations

implements all methods of PlatformInterface

get_maya_location()[source]

Return the installation path to maya

Returns:path to maya
Return type:str
Raises:errors.SoftwareNotFoundError
get_maya_sitepackage_dir()[source]

Return the sitepackage dir for maya

Returns:path to the maya sitepackages
Return type:str
Raises:errors.SoftwareNotFoundError
get_maya_bin()[source]

Return the path to the maya bin dir

Returns:path to maya bin dir
Return type:str
Raises:errors.SoftwareNotFoundError
get_maya_python()[source]

Return the path to the mayapy executable

Returns:path to the maya python intepreter
Return type:str
Raises:errors.SoftwareNotFoundError
get_maya_exe()[source]

Return the path to the maya executable

Returns:path to the maya exe
Return type:str
Raises:errors.SoftwareNotFoundError
get_maya_envpath()[source]

Return the PYTHONPATH neccessary for running mayapy

If you start native mayapy, it will setup these paths. You might want to prepend this to your path if running from an external intepreter.

Returns:the PYTHONPATH that is used for running mayapy
Return type:str
Raises:None
open_path(path)[source]

Open the given path in the file browser

Parameters:path (str) – the path to open
Returns:None
Return type:None
Raises:None
jukeboxcore.ostool.interfaces = {'Windows': <class 'jukeboxcore.ostool.WindowsInterface'>}

Dictionary for platforminterfaces. Values are PlatformInterface subclasses and keys are values of detect_sys()[‘system’]

jukeboxcore.ostool.get_interface()[source]

Return the appropriate PlatformInterface implementation for your platform

Returns:the appropriate platform interface for my platform
Return type:PlatformInterface`
Raises:errors.UnsupportedPlatformError