~ubuntu-tour/+junk/new-lang-system

« back to all changes in this revision

Viewing changes to extras.py

  • Committer: Anthony Stewart
  • Date: 2011-04-13 21:04:26 UTC
  • Revision ID: madnessred@gmail.com-20110413210426-x336oab2lh2h2b35
starting with new tour.py system

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/python
2
2
 
3
3
import os
4
 
import tour
5
 
#from tour import p
6
 
 
7
 
 
 
4
import sys
 
5
import platform
 
6
 
 
7
 
 
8
#Used to find things like -a (can be extracted from something like -abc).
 
9
def get_flag(flag):
 
10
        for arg in sys.argv:
 
11
                if len(arg) >= 2:
 
12
                        if arg[0] == '-' and arg[1] != '-' and arg.find(flag) != -1:
 
13
                                return True
 
14
        return False
 
15
 
 
16
#Used to find things like --version.
 
17
def get_argument(argument):
 
18
        return "--" + argument in sys.argv
 
19
 
 
20
#Check os version
 
21
def check_os(osys, required):
 
22
        # Are we using Ubuntu?
 
23
        if osys == platform.dist()[0]:
 
24
        
 
25
                #What version?
 
26
                version = platform.dist()[1].split('.')
 
27
                version = float(version[0] + '.' + version[1] + '0' + ''.join(version[2:]))
 
28
        
 
29
                #Is that high enough?
 
30
                if version >= required:
 
31
                        return True
 
32
                else:
 
33
                        return False
 
34
        else:
 
35
                return False
 
36
 
 
37
#Get default app
8
38
def GetDefaultApp(Type):
9
39
        App = ""
10
40
        if (Type.lower() == "browser"):