mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 21:03:12 +00:00
Make fish_config compatible with Python 2.5
Try to import parse_qs from the cgi module, and simplejson instead of json. Use old string formatting. str.format() was backported from Python 3 to 2.6 and isn't available in 2.5.
This commit is contained in:
parent
d4a171a791
commit
56dd25667d
1 changed files with 11 additions and 4 deletions
|
@ -7,14 +7,21 @@ IS_PY2 = sys.version_info[0] == 2
|
||||||
if IS_PY2:
|
if IS_PY2:
|
||||||
import SimpleHTTPServer
|
import SimpleHTTPServer
|
||||||
import SocketServer
|
import SocketServer
|
||||||
from urlparse import parse_qs
|
try:
|
||||||
|
from urllib.parse import parse_qs
|
||||||
|
except ImportError:
|
||||||
|
from cgi import parse_qs
|
||||||
else:
|
else:
|
||||||
import http.server as SimpleHTTPServer
|
import http.server as SimpleHTTPServer
|
||||||
import socketserver as SocketServer
|
import socketserver as SocketServer
|
||||||
from urllib.parse import parse_qs
|
from urllib.parse import parse_qs
|
||||||
import webbrowser
|
import webbrowser
|
||||||
import subprocess
|
import subprocess
|
||||||
import re, json, socket, os, sys, cgi, select, time, glob
|
import re, socket, os, sys, cgi, select, time, glob
|
||||||
|
try:
|
||||||
|
import json
|
||||||
|
except ImportError:
|
||||||
|
import simplejson as json
|
||||||
|
|
||||||
def run_fish_cmd(text):
|
def run_fish_cmd(text):
|
||||||
from subprocess import PIPE
|
from subprocess import PIPE
|
||||||
|
@ -605,8 +612,8 @@ if len(sys.argv) > 1:
|
||||||
initial_tab = '#' + tab
|
initial_tab = '#' + tab
|
||||||
break
|
break
|
||||||
|
|
||||||
url = 'http://localhost:{0}/{1}'.format(PORT, initial_tab)
|
url = 'http://localhost:%d/%s' % (PORT, initial_tab)
|
||||||
print("Web config started at '{0}'. Hit enter to stop.".format(url))
|
print("Web config started at '%s'. Hit enter to stop." % url)
|
||||||
webbrowser.open(url)
|
webbrowser.open(url)
|
||||||
|
|
||||||
# Select on stdin and httpd
|
# Select on stdin and httpd
|
||||||
|
|
Loading…
Reference in a new issue