def __init__(self, name): r"""Platform object is created from an informal name identifier. :param str name: identifier for a platform. Examples: - "x86_64-linux" (same as "x86_64-linux-gnu") - "ppc64le-linux" (same as "ppc64le-linux-gnu") - "arm-linux" (same as "arm-linux-gnueabihf") - "x32" (same as "x86_64-linux-gnux32") - "x86_64-nacl" (same as "x86_64-nacl-newlib") - "pnacl" (same as "pnacl-nacl-newlib") - "asmjs" (same as "asmjs-emscripten") - "wasm" (same as "wasm32-emscripten") """ from confu.validators import validate_platform_name self.name = validate_platform_name(name) parts = self.name.split("-") self.arch, self.os = parts[0:2]
def __eq__(self, other): from confu.validators import validate_platform_name try: return self.name == validate_platform_name(other) except: return isinstance(other, Platform) and self.name == other.name