join
[send] / skeet
1 #!/usr/bin/env python
2 # coding=utf-8
3 #    ______________________________________________________________________________________________
4 #  /|                                                                                              |\
5 # |||  ☻ BASE ☻ SKEET ☻ BALL ☻                                                                     |||
6 # |||                                                                                              |||
7 # |||  ~ ~ ~ ~ ~  >>>>>>>>>>>,,,>>>>>,                                                             |||
8 # |||            >,,,,>,,,,>>,,>>,,,>                                                              |||
9 # |||  ~ ~ ~ ~  >>>>>>>>>>>,>,>>,,,>                                                               |||
10 # |||          ,,,,>>,,,,>,,>>>,,,>   a 0eggxactly production ........ [http://shampoo.ooo]        |||
11 # |||  ~ ~ ~  >>>>>>>>>>>,,,>>>>>,    by @ohsqueezy .......... [http://twitter.com/diskmem]        |||
12 # |||                                                                                              |||
13 # |||  + free to use, copy, modify and sell under the zlib license (see LICENSE.txt)               |||
14 # ||!  + more games and code available at [http://itch.io/ohsqueezy] and [http://git.shampoo.ooo]  !||
15 # |!'______________________________________________________________________________________________'!|
16 # !'================================================================================================'!
17 #  """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
18
19 from os import environ, execvp, chdir, getcwd
20 from os.path import exists, join, dirname
21 from sys import version_info, argv
22
23 def can_import(module_name):
24     try:
25         __import__(module_name)
26     except ImportError:
27         return False
28     else:
29         return True
30
31 def is_python_3():
32     return version_info[0] >= 3
33
34 def is_current_version(file_name):
35     version = map(int, file_name.replace("python", "").split("."))
36     return version == list(version_info)[:2]
37
38 def launch_alternative(alternatives):
39     for alternative in alternatives:
40         if not is_current_version(alternative):
41             for root in environ["PATH"].split(":"):
42                 if exists(join(root, alternative)):
43                     execvp(alternative, [alternative] + argv)
44
45 def move_to_executable():
46     chdir(dirname(argv[0]))
47
48 # if is_python_3():
49 #     launch_alternative(["python2", "python2.7", "python2.6"])
50
51 # if not can_import("pygame"):
52 #     launch_alternative(["python2.7", "python2.6"])
53
54 if "--go-to-dir" in argv:
55     move_to_executable()
56
57 from _send.Send import Send
58
59 Send().run()