‘platformids’ - package

Sources

platformids package

Submodules

platformids.map_enum_labels module

Mapping of numeric and symbolic enum strings, optional loaded on demand for human display of debug info only.

platformids.map_enum_labels.num2enumstr = {131392: 'RTE_DEBIAN', 131137: 'RTE_CENTOS', 131074: 'RTE_CYGWIN', 65667: 'RTE_WIN10', 131076: 'RTE_DARWIN', 131141: 'RTE_CENTOS4', 131142: 'RTE_CENTOS5', 131143: 'RTE_CENTOS6', 131144: 'RTE_CENTOS7', 131401: 'RTE_DEBIAN9', 65664: 'RTE_WIN7', 131232: 'RTE_SUSE', 131264: 'RTE_UBUNTU', 131360: 'RTE_FREEBSD', 131088: 'RTE_SOLARIS', 65547: 'RTE_WINNT4S', 65554: 'RTE_WINS2000S', 65555: 'RTE_WINS2008', 131108: 'RTE_DRAGONFLYBSD', 65536: 'RTE_WIN32', 131072: 'RTE_POSIX', 131104: 'RTE_BSD', 65552: 'RTE_WIN2000', 65537: 'RTE_DOS', 131398: 'RTE_DEBIAN6', 65553: 'RTE_WINS2000WS', 131136: 'RTE_LINUX', 65680: 'RTE_WINS2012', 131399: 'RTE_DEBIAN7', 131168: 'RTE_OPENBSD', 131120: 'RTE_NETBSD', 131400: 'RTE_DEBIAN8', 131187: 'RTE_FEDORA19', 131080: 'RTE_OSX', 65545: 'RTE_WINNT4', 131195: 'RTE_FEDORA27', 65546: 'RTE_WINNT4WS'}

mapping of the numeric value to it’s symbolic representation

Module contents

The package ‘platformids’ provides canonical enumerations of bit encoded numeric platform IDs.

platformids.ISSTR = (<type 'str'>, <type 'unicode'>)

string and unicode

platformids.PYVxyz = 18181

The Python release of current process

exception platformids.PlatformIDsError[source]

Bases: exceptions.Exception

Subsystem PlatformIDs.

class platformids.ProtectedDict[source]

Bases: dict

platformids.RTE_BSD = 131104

BSD, - OpenBSD, FreeBSD, NetBSD - as Posix system [POSIX].

platformids.RTE_CENTOS = 131137

CentOS

platformids.RTE_CENTOS4 = 131141

CentOS-4

platformids.RTE_CENTOS5 = 131142

CentOS-5

platformids.RTE_CENTOS6 = 131143

CentOS-6

platformids.RTE_CENTOS7 = 131144

CentOS-7

platformids.RTE_CNP = 131072

cross native Posix systems using fcntl [POSIX].

platformids.RTE_CNW = 65537

cross native all Windows systems [MS-DTYP], slightly different from RTE_WIN32

platformids.RTE_CYGWIN = 131074

Cygwin [CYGWIN]

platformids.RTE_DARWIN = 131076

Darwin/OS-X, as Posix system [POSIX], no macpath-legacy.

platformids.RTE_DEBIAN = 131392

Debian

platformids.RTE_DEBIAN6 = 131398

Debian - squeeze

platformids.RTE_DEBIAN7 = 131399

Debian - wheezy

platformids.RTE_DEBIAN8 = 131400

Debian - jessy

platformids.RTE_DEBIAN9 = 131401

Debian - stretch

platformids.RTE_DOS = 65537

MS-DOS - frozen

platformids.RTE_FEDORA = 131168

Fedora

platformids.RTE_FEDORA19 = 131187

Fedora-19

platformids.RTE_FEDORA27 = 131195

Fedora-27

platformids.RTE_GENERIC = 0

Use the current block-offset only, results in the current platformm enum.

platformids.RTE_LINUX = 131136

Linux with specific add-ons - OS, DIST, GNU - as Posix system [POSIX].

platformids.RTE_LOCAL = 1

Dyanmic local platform, synonym for generic.

platformids.RTE_OSX = 131080

Darwin/OS-X, as Posix system [POSIX], no macpath-legacy.

platformids.RTE_POSIX = 131072

Posix systems using fcntl [POSIX].

platformids.RTE_POWERSHELL1 = 65600

PowerShell-1-Windows

platformids.RTE_POWERSHELL2 = 65601

PowerShell-2-Windows

platformids.RTE_POWERSHELL2LINUX = 65602

PowerShell-2-Linux

platformids.RTE_SOLARIS = 131088

UNIX/Solaris, as Posix system [POSIX].

platformids.RTE_SUSE = 131232

OpenSUSE

platformids.RTE_UBUNTU = 131264

OpenSUSE

platformids.RTE_WIN10 = 65667

Windows10

platformids.RTE_WIN2000 = 65552

Windows-2000 - frozen

platformids.RTE_WIN32 = 65536

all Windows systems [MS-DTYP]

platformids.RTE_WIN7 = 65664

Windows7

platformids.RTE_WIN8 = 65665

Windows7

platformids.RTE_WIN81 = 65666

Windows7

platformids.RTE_WINNT4 = 65545

Windows-NT4 - frozen

platformids.RTE_WINNT4S = 65547

Windows-NT4-Server - frozen

platformids.RTE_WINNT4WS = 65546

Windows-NT4-Workstation - frozen

platformids.RTE_WINS2000S = 65554

Windows-2000-Server - frozen

platformids.RTE_WINS2000WS = 65553

Windows-2000-Workstation - frozen

platformids.RTE_WINS2008 = 65555

Windows-2008-Server - frozen

platformids.RTE_WINS2012 = 65680

Windows-2012-Server

platformids.V3K = False

Python3.5+

platformids.getPYVxyz(x=0, y=0, z=0)[source]

Calculates the 16bit integer bi-mask for the provided Python release values. For example from sys.version_info:

x = sys.version_info[0]  # uses 3bits:  x: 0-7
y = sys.version_info[1]  # uses 5bits:  y: 0-31
z = sys.version_info[2]  # uses 8bits:  z: 0-255

resulting in:

Vxyz = 0bxxxyyyyyzzzzzzzz

For example:

x, y, z = (3, 6, 5)

self.bits = (3, 5, 8)

# => result = 0b 011 00110 00000101 
# => result = 0b0110011000000101 =  26,117
Args:
x:

The major version number.

0 <= y

0 <= y0 < 4  # internal low-level 16-bit optimization threshold 
y:
The minor version number. ::
0 <= y < 63
z:

The numeric relase-build tag.

0 <= y < 257
Returns:
The bit-mask.
Raises:
pass-through
platformids.get_custom_num_base()[source]

Reserves and returns the current available base value for the next bit-block. Each reserved bit-block for custom usage is 16-bit wide, and could be used by the application arbitrarily.

Each call increments the integer address of the next free block by one bit.

Note

In current release the reservation of the value ranges for bit-blocks is not released until the process termination.

Args:
None
Returns:
The base index for the new reservation.
Raises:
pass-through
platformids.get_custom_num_range()[source]

Returns the available range of values for elements within bit blocks.

Args:
None.
Returns:

The inclusive range as tuple:

(min, max)
Raises:
None
platformids.get_num2rte(num)[source]

Gets the corresponding string representation for the string numeric value.

Alternatively the official dict num2rte could be used.

Args:
num:
Numeric enum value of the requested platform.
Returns:
The string value, or None*.
Raises:
None
platformids.get_rte2num(rte)[source]

Gets corresponding numerical representation for the numeric or string value.

Alternatively the official dict rte2num could be used.

Args:
rte:
Numeric enum value or string representation of the requested platform.
Returns:
The numeric value, or None*.
Raises:
None
platformids.num2rte = {65664: 'win7', 131264: 'ubuntu', 131074: 'cygwin', 65667: 'win10', 65536: 'win32', 65537: 'dos', 131136: 'linux', 65545: 'winnt4', 65546: 'winnt4ws', 65547: 'winnt4s', 131088: 'solaris', 65553: 'winnt2000ws', 65554: 'winnt2000s', 65555: 'winnt2008', 131072: 'posix', 131232: 'suse', 131108: 'dragonfly', 131398: 'debian6', 131399: 'debian7', 131120: 'netbsd', 131400: 'debian8', 131392: 'debian', 131137: 'centos', 131141: 'centos4', 131142: 'centos5', 131143: 'centos6', 131144: 'centos7', 131401: 'debian9', 131360: 'freebsd', 131168: 'openbsd', 65552: 'win2000', 131104: 'bsd', 65680: 'winnt2012', 131187: 'fedora19', 131195: 'fedora27'}

mapping of the rte numeric representation to the string value

platformids.rte2num = {131072: 131072, 65537: 65537, 131074: 131074, 'solaris': 131088, 65536: 65536, 131080: 131080, 'win': 65536, 65546: 65546, 65547: 65547, 65552: 65552, 65553: 65553, 65554: 65554, 65555: 65555, 'winnt2012': 65680, 'linux': 131136, 'suse': 131232, 'netbsd': 131120, 131104: 131104, 131108: 131108, 131120: 131120, 'win2000': 65552, 65545: 65545, 131136: 131136, 131137: 131137, 131398: 131398, 131141: 131141, 131142: 131142, 131399: 131399, 131400: 131400, 131401: 131401, 'dos': 65537, 131168: 131168, 'debian7': 131399, 'debian8': 131400, 'debian9': 131401, 'win32': 65536, 131187: 131187, 'posix': 131072, 'winnt2000s': 65554, 131144: 131144, 131195: 131195, 131076: 131076, 65664: 65664, 131392: 131392, 65667: 65667, 'openbsd': 131168, 'centos': 131137, 'dragonfly': 131108, 65680: 65680, 131232: 131232, 'fedora': 131168, 'debian6': 131398, 131143: 131143, 'win7': 65664, 'fedora27': 131195, 'centos7': 131144, 'centos6': 131143, 'centos5': 131142, 'centos4': 131141, 131264: 131264, 131360: 131360, 'winnt4ws': 65546, 'winnt2000ws': 65553, 'cygwin': 131074, 'ubuntu': 131264, 'bsd': 131104, 'winnt2008': 65555, 'debian': 131392, 'winnt4': 65545, 131088: 131088, 'freebsd': 131360, 'win10': 65667, 'fedora19': 131187, 'winnt4s': 65547}

mapping of the rte string and numeric representation to the numeric value

platformids.set_num2rte(key, value)[source]

Sets the numeric to string map.

Alternatively the official dict num2rte could be used.

Args:
key:
Numeric key value.
value:
String value.
Returns:
None
Raises:
PlatformIDsError
platformids.set_rte2num(key, value)[source]

Sets the rte to numeric mapping

Alternatively the official dict rte2num could be used.

Args:
key:
Numeric or string key value.
value:
Numeric value.
Returns:
None
Raises:
None