Add basic functionnality to guess operating system

parent 02057b2e
...@@ -31,6 +31,7 @@ import setuptools ...@@ -31,6 +31,7 @@ import setuptools
import shlex import shlex
import shutil import shutil
import subprocess import subprocess
import sys
import tempfile import tempfile
import zc.buildout import zc.buildout
...@@ -41,6 +42,12 @@ ARCH_MAP = { ...@@ -41,6 +42,12 @@ ARCH_MAP = {
'x86_64': 'x86-64' 'x86_64': 'x86-64'
} }
OS_MAP = {
'darwin': 'mac',
'linux2': 'linux'
#To be continued
}
def readElfAsDict(f): def readElfAsDict(f):
"""Reads ELF information from file""" """Reads ELF information from file"""
...@@ -102,13 +109,17 @@ def guessworkdir(path): ...@@ -102,13 +109,17 @@ def guessworkdir(path):
return os.path.join(path, os.listdir(path)[0]) return os.path.join(path, os.listdir(path)[0])
return path return path
def guessPlatform(): def guessPlatform():
arch = uname()[-2] arch = uname()[-2]
target = ARCH_MAP.get(arch) target = ARCH_MAP.get(arch)
assert target, 'Unknown architecture' assert target, 'Unknown architecture'
return target return target
def guessOperatingSystem():
platform = sys.platform
target = OS_MAP.get(platform)
assert target, 'Unknown architecture'
return target
TRUE_LIST = ('y', 'on', 'yes', 'true', '1') TRUE_LIST = ('y', 'on', 'yes', 'true', '1')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment