Created
September 9, 2014 09:33
-
-
Save iOS0x00/54dc3759833a82aebc80 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
# vim: ts=4:sw=4:expandtab | |
""" | |
Copyright (c) 2014 SysDev Tools. | |
""" | |
import os | |
import sys | |
class WrongTargetException(Exception): | |
def __init__(self, str): | |
self.str = str | |
def __str__(self): | |
print ':', self.str | |
def check_os_version(): | |
platform, domain, kernel, date, arch = os.uname() | |
if platform.lower() != 'linux': | |
raise WrongTargetException('This system platform is not Linux, abort!') | |
if arch != 'x86_64': | |
raise WrongTargetException('This system arch is not x86_64, abort!') | |
return | |
def check_python_version(): | |
version_info = sys.version.split(' ') | |
python_version = version_info[0] | |
if python_version[:3] != '2.7': | |
raise WrongTargetException('This python version is not 2.7.x, abort!') | |
return | |
def check_pip_version(): | |
import pip | |
pip_version = pip.__version__ | |
if pip_version[:3] != '1.5': | |
raise WrongTargetException('PIP version too lower, pls update to 1.5, abort!') | |
def main(): | |
check_os_version() | |
check_python_version() | |
check_pip_version() | |
print 'yes' | |
if __name__ == '__main__': | |
main() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment