Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 396 lines (373 sloc) 16.098 kb
04f2eab @liftoff Commit #1: The Gate One beta is about to go public.
authored
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3
ab55682 @liftoff IMPORTANT PACKAGING CHANGE: /opt/gateone is no more! See the commit me...
authored
4 from setuptools import setup
1528d32 @liftoff NOTE: YOU MAY HAVE TO REMOVE/REINSTALL GATE ONE (see setup.py notes bel...
authored
5 from setuptools.command.install import install
6 from distutils.command.install import INSTALL_SCHEMES
24a0aff @liftoff INSTALL.txt: Updated to reflect the new packaging locations and whatnot...
authored
7 import sys, os, shutil, io
ab55682 @liftoff IMPORTANT PACKAGING CHANGE: /opt/gateone is no more! See the commit me...
authored
8
d214f91 @liftoff NOTE: Lots of tidying-up in this commit. Functions were moved around a...
authored
9 for scheme in INSTALL_SCHEMES.values():
10 scheme['data'] = scheme['purelib']
11
fe1287b @liftoff TORNADO 2.2 IS OUT. This version is now required to use Gate One as it ...
authored
12 # Globals
a87694a @liftoff Lots of Python 3 fixes this commit...
authored
13 PYTHON3 = False
fe1287b @liftoff TORNADO 2.2 IS OUT. This version is now required to use Gate One as it ...
authored
14 POSIX = 'posix' in sys.builtin_module_names
bc1ca60 @liftoff Everywhere: Renamed ApplicationWebSocket.policies (the RUDict) to Appli...
authored
15 version = '1.2.0'
d8fe32a @liftoff gateone.js: Increased `GateOne.Base.dependencyTimeout` from 5 to 15 sec...
authored
16 requires = ["tornado >=3.2", "html5lib >= 0.999"]
0c26ebc @liftoff utils.py: A minor fix for Python 3 compatibility in the valid_hostname(...
authored
17 extra = {}
ab55682 @liftoff IMPORTANT PACKAGING CHANGE: /opt/gateone is no more! See the commit me...
authored
18 data_files = []
2aecefa @liftoff PYTHON 3 SUPPORT HAS BEEN ADDED!
authored
19 major, minor = sys.version_info[:2] # Python version
20 if major == 2 and minor <=5:
21 print("Gate One requires Python 2.6+. You are running %s" % sys.version)
22 sys.exit(1)
ab55682 @liftoff IMPORTANT PACKAGING CHANGE: /opt/gateone is no more! See the commit me...
authored
23 if major == 2:
0aecd45 @liftoff app_terminal.py: Fixed a cosmetic bug where the list of enabled plugins...
authored
24 from distutils.command.build_py import build_py
24a0aff @liftoff INSTALL.txt: Updated to reflect the new packaging locations and whatnot...
authored
25 from commands import getstatusoutput
ab55682 @liftoff IMPORTANT PACKAGING CHANGE: /opt/gateone is no more! See the commit me...
authored
26 requires.append('futures') # Added in 3.2 (only needed in 2.6 and 2.7)
27 if major == 2 and minor == 6:
28 requires.append('ordereddict') # This was added in Python 2.7+
2aecefa @liftoff PYTHON 3 SUPPORT HAS BEEN ADDED!
authored
29 if major == 3:
a87694a @liftoff Lots of Python 3 fixes this commit...
authored
30 PYTHON3 = True
24a0aff @liftoff INSTALL.txt: Updated to reflect the new packaging locations and whatnot...
authored
31 from subprocess import getstatusoutput
ab55682 @liftoff IMPORTANT PACKAGING CHANGE: /opt/gateone is no more! See the commit me...
authored
32 extra['use_2to3'] = True # Automatically convert to Python 3; love it!
2aecefa @liftoff PYTHON 3 SUPPORT HAS BEEN ADDED!
authored
33 try:
0aecd45 @liftoff app_terminal.py: Fixed a cosmetic bug where the list of enabled plugins...
authored
34 from distutils.command.build_py import build_py_2to3 as build_py
2aecefa @liftoff PYTHON 3 SUPPORT HAS BEEN ADDED!
authored
35 except ImportError:
36 print("Python 3.X support requires the 2to3 tool.")
0aecd45 @liftoff app_terminal.py: Fixed a cosmetic bug where the list of enabled plugins...
authored
37 print(
38 "It normally comes with Python 3.X but (apparenty) not on your "
39 "distribution.\nPlease find out what package you need to get 2to3"
40 "and install it.")
2aecefa @liftoff PYTHON 3 SUPPORT HAS BEEN ADDED!
authored
41 sys.exit(1)
42
24a0aff @liftoff INSTALL.txt: Updated to reflect the new packaging locations and whatnot...
authored
43 def which(binary, path=None):
44 """
45 Returns the full path of *binary* (string) just like the 'which' command.
46 Optionally, a *path* (colon-delimited string) may be given to use instead of
47 `os.environ['PATH']`.
48 """
49 if path:
50 paths = path.split(':')
51 else:
52 paths = os.environ['PATH'].split(':')
53 for path in paths:
54 if not os.path.exists(path):
55 continue
56 files = os.listdir(path)
57 if binary in files:
58 return os.path.join(path, binary)
59 return None
60
2aecefa @liftoff PYTHON 3 SUPPORT HAS BEEN ADDED!
authored
61 # Some paths we can reference
711e02d @liftoff Added a whole bunch of init scripts to properly daemonize Gate One on ea...
authored
62 setup_dir = os.path.dirname(os.path.abspath(__file__))
63 build_dir = os.path.join(setup_dir, 'build')
64 if not os.path.exists(build_dir):
65 # Make the build dir a little early so we can use it as a temporary place
66 # to store build files
67 os.mkdir(build_dir)
68
69 # Detect appropriate init script and make sure it is put in the right place
1528d32 @liftoff NOTE: YOU MAY HAVE TO REMOVE/REINSTALL GATE ONE (see setup.py notes bel...
authored
70 skip_init = False
71 if '--skip_init_scripts' in sys.argv:
72 skip_init = True
73 sys.argv.remove('--skip_init_scripts')
711e02d @liftoff Added a whole bunch of init scripts to properly daemonize Gate One on ea...
authored
74 init_script = []
75 conf_file = [] # Only used on Gentoo
576b37f @liftoff Added an Upstart script for Ubuntu and tweaked gateone-debian.sh to use ...
authored
76 upstart_file = [] # Only used on Ubuntu (I think)
3674adb @liftoff core/utils.py: Added a helpful message to `killall()` to indicate that ...
authored
77 systemd_file = [] # Only used on systems with systemd
711e02d @liftoff Added a whole bunch of init scripts to properly daemonize Gate One on ea...
authored
78 debian_script = os.path.join(setup_dir, 'scripts/init/gateone-debian.sh')
79 redhat_script = os.path.join(setup_dir, 'scripts/init/gateone-redhat.sh')
aefd4ad @gr0undzer0 Auto intall freebsd init script
gr0undzer0 authored
80 freebsd_script = os.path.join(setup_dir, 'scripts/init/gateone-freebsd.sh')
711e02d @liftoff Added a whole bunch of init scripts to properly daemonize Gate One on ea...
authored
81 gentoo_script = os.path.join(setup_dir, 'scripts/init/gateone-gentoo.sh')
24a0aff @liftoff INSTALL.txt: Updated to reflect the new packaging locations and whatnot...
authored
82 openwrt_script = os.path.join(setup_dir, 'scripts/init/gateone-openwrt.sh')
576b37f @liftoff Added an Upstart script for Ubuntu and tweaked gateone-debian.sh to use ...
authored
83 upstart_script = os.path.join(setup_dir, 'scripts/init/gateone.conf')
24a0aff @liftoff INSTALL.txt: Updated to reflect the new packaging locations and whatnot...
authored
84 systemd_service = os.path.join(setup_dir, 'scripts/init/gateone.service')
711e02d @liftoff Added a whole bunch of init scripts to properly daemonize Gate One on ea...
authored
85 temp_script_path = os.path.join(setup_dir, 'build/gateone')
68c3ef6 @liftoff Improved the FreeBSD init script support in setup.py. It will now autom...
authored
86 bsd_temp = os.path.join(setup_dir, 'build/freebsd')
87 bsd_temp_script = os.path.join(bsd_temp, 'gateone')
576b37f @liftoff Added an Upstart script for Ubuntu and tweaked gateone-debian.sh to use ...
authored
88 upstart_temp_path = os.path.join(setup_dir, 'build/gateone.conf')
24a0aff @liftoff INSTALL.txt: Updated to reflect the new packaging locations and whatnot...
authored
89 systemd_temp_path = os.path.join(setup_dir, 'build/gateone.service')
1528d32 @liftoff NOTE: YOU MAY HAVE TO REMOVE/REINSTALL GATE ONE (see setup.py notes bel...
authored
90 if not skip_init:
91 if os.path.exists('/etc/debian_version'):
92 shutil.copy(debian_script, temp_script_path)
93 elif os.path.exists('/etc/redhat-release'):
94 shutil.copy(redhat_script, temp_script_path)
95 elif os.path.exists('/etc/freebsd-update.conf'):
96 if not os.path.isdir(bsd_temp):
97 os.mkdir(bsd_temp)
98 shutil.copy(freebsd_script, bsd_temp_script)
99 elif os.path.exists('/etc/gentoo-release'):
100 shutil.copy(gentoo_script, temp_script_path)
101 conf_file = ['/etc/conf.d', [
102 os.path.join(setup_dir, 'scripts/conf/gateone')
103 ]]
104 elif os.path.exists('/etc/openwrt_release'):
105 shutil.copy(openwrt_script, temp_script_path)
106 # Handle the upstart script (Ubuntu only as far as I know)
107 if os.path.isdir('/etc/init'):
108 shutil.copy(upstart_script, upstart_temp_path)
109 upstart_file = ['/etc/init', [upstart_temp_path]]
110 # Handle systemd (can be used in conjunction with other init processes)
111 systemd = which('systemd-notify')
112 if systemd:
24a0aff @liftoff INSTALL.txt: Updated to reflect the new packaging locations and whatnot...
authored
113 # System is using systemd
114 shutil.copy(systemd_service, systemd_temp_path)
115 # This pkg-config command tells us where to put systemd .service files:
116 retcode, systemd_system_unit_dir = getstatusoutput(
117 'pkg-config systemd --variable=systemdsystemunitdir')
3674adb @liftoff core/utils.py: Added a helpful message to `killall()` to indicate that ...
authored
118 systemd_file = [systemd_system_unit_dir, [systemd_temp_path]]
1528d32 @liftoff NOTE: YOU MAY HAVE TO REMOVE/REINSTALL GATE ONE (see setup.py notes bel...
authored
119 # Handle FreeBSD and regular init.d scripts
120 if os.path.exists(bsd_temp_script):
121 init_script = ['/usr/local/etc/rc.d', [bsd_temp_script]]
122 elif os.path.exists(temp_script_path):
123 init_script = ['/etc/init.d', [temp_script_path]]
711e02d @liftoff Added a whole bunch of init scripts to properly daemonize Gate One on ea...
authored
124
ab55682 @liftoff IMPORTANT PACKAGING CHANGE: /opt/gateone is no more! See the commit me...
authored
125 # NOTE: This function was copied from Django's setup.py (thanks guys!)
126 def fullsplit(path, result=None):
127 """
128 Split a pathname into components (the opposite of os.path.join) in a
129 platform-neutral way.
130 """
131 if result is None:
132 result = []
133 head, tail = os.path.split(path)
134 if head == '':
135 return [tail] + result
136 if head == path:
137 return result
138 return fullsplit(head, [tail] + result)
139
140 gateone_dir = os.path.join(setup_dir, 'gateone')
f9e8971 @liftoff GATE ONE HAS NOW BEEN TRANSLATED (probably badly) into: German, Portugeu...
authored
141 plugin_dir = os.path.join(gateone_dir, 'plugins')
142 app_dir = os.path.join(gateone_dir, 'applications')
ab55682 @liftoff IMPORTANT PACKAGING CHANGE: /opt/gateone is no more! See the commit me...
authored
143
144 ignore_list = [
145 '__pycache__',
146 '.kate-swp',
147 '.pyc',
148 '.pyo',
149 '.pye',
150 '.git',
151 '.gitignore',
152 '.jse'
d3fde76 @liftoff MAJOR CHANGES/IMPROVEMENTS in this commit. New settings format, new app...
authored
153 ]
ab55682 @liftoff IMPORTANT PACKAGING CHANGE: /opt/gateone is no more! See the commit me...
authored
154 packages = ['termio', 'terminal', 'onoff']
24a0aff @liftoff INSTALL.txt: Updated to reflect the new packaging locations and whatnot...
authored
155 if '--skip_docs' in sys.argv:
156 ignore_list.append('docs')
157 sys.argv.remove('--skip_docs')
ab55682 @liftoff IMPORTANT PACKAGING CHANGE: /opt/gateone is no more! See the commit me...
authored
158
f9e8971 @liftoff GATE ONE HAS NOW BEEN TRANSLATED (probably badly) into: German, Portugeu...
authored
159 os.chdir(setup_dir)
ab55682 @liftoff IMPORTANT PACKAGING CHANGE: /opt/gateone is no more! See the commit me...
authored
160 for dirpath, dirnames, filenames in os.walk('gateone'):
161 # Ignore PEP 3147 cache dirs and those whose names start with '.'
162 dirnames[:] = [
163 d for d in dirnames
164 if not d.startswith('.')
165 and d not in ignore_list
166 ]
167 if '__init__.py' in filenames:
168 package = '.'.join(fullsplit(dirpath))
d214f91 @liftoff NOTE: Lots of tidying-up in this commit. Functions were moved around a...
authored
169 packages.append(package)
ab55682 @liftoff IMPORTANT PACKAGING CHANGE: /opt/gateone is no more! See the commit me...
authored
170 elif filenames:
171 data_files.append([
172 dirpath, [os.path.join(dirpath, f)
173 for f in filenames
174 if f not in ignore_list]
175 ])
176
f9e8971 @liftoff GATE ONE HAS NOW BEEN TRANSLATED (probably badly) into: German, Portugeu...
authored
177 entry_points = {
c41a6ca @liftoff core/server.py: `ApplicationWebSocket.set_locale()` has been renamed to...
authored
178 'console_scripts': ['gateone = gateone.core.server:main'],
f9e8971 @liftoff GATE ONE HAS NOW BEEN TRANSLATED (probably badly) into: German, Portugeu...
authored
179 'go_plugins': [],
180 'go_applications': [],
181 }
182 # Add plugin entry points for Python plugins
183 plugin_ep_template = '{name} = gateone.plugins.{name}'
184 for filename in os.listdir(plugin_dir):
185 path = os.path.join(plugin_dir, filename)
186 if os.path.isdir(path):
187 if '__init__.py' in os.listdir(path):
188 entry_points['go_plugins'].append(
189 plugin_ep_template.format(name=filename))
190 # Add application (and their plugins) entry points
191 app_ep_template = '{name} = gateone.applications.{name}'
192 app_plugin_ep_template = '{name} = gateone.applications.{app}.plugins.{name}'
193 for filename in os.listdir(app_dir):
194 path = os.path.join(app_dir, filename)
195 if os.path.isdir(path):
196 if '__init__.py' in os.listdir(path):
197 entry = app_ep_template.format(name=filename)
198 entry_points['go_applications'].append(entry)
199 if 'plugins' in os.listdir(path):
200 plugins_path = os.path.join(path, 'plugins')
201 for f in os.listdir(plugins_path):
202 ppath = os.path.join(plugins_path, f)
203 if os.path.isdir(ppath):
204 if '__init__.py' in os.listdir(ppath):
205 plugin_ep_name = 'go_%s_plugins' % filename
206 entry = app_plugin_ep_template.format(
207 app=filename, name=f)
208 if not plugin_ep_name in entry_points:
209 entry_points[plugin_ep_name] = []
210 entry_points[plugin_ep_name].append(entry)
211
1528d32 @liftoff NOTE: YOU MAY HAVE TO REMOVE/REINSTALL GATE ONE (see setup.py notes bel...
authored
212 if os.getuid() == 0 and not skip_init:
ab55682 @liftoff IMPORTANT PACKAGING CHANGE: /opt/gateone is no more! See the commit me...
authored
213 if init_script:
214 data_files.append(init_script)
215 if conf_file:
216 data_files.append(conf_file)
217 if upstart_file:
218 data_files.append(upstart_file)
3674adb @liftoff core/utils.py: Added a helpful message to `killall()` to indicate that ...
authored
219 if systemd_file:
220 data_files.append(systemd_file)
ab55682 @liftoff IMPORTANT PACKAGING CHANGE: /opt/gateone is no more! See the commit me...
authored
221 else:
222 print("You are not root; skipping installation of init scripts.")
5b9594b @liftoff gateone.py: When debug=True, clean out the cache_dir with each reload.
authored
223
ab55682 @liftoff IMPORTANT PACKAGING CHANGE: /opt/gateone is no more! See the commit me...
authored
224 # Try minifying gateone.js
225 try:
226 import slimit
227 static_dir = os.path.join(setup_dir, 'gateone', 'static')
228 gateone_js = os.path.join(static_dir, 'gateone.js')
229 gateone_min_js = os.path.join(static_dir, 'gateone.min.js')
230 with open(gateone_js, 'rb') as f:
231 data = f.read()
80aa41e @liftoff terminal.js: Added GateOne.Terminal.clearScrollback(term); it just empt...
authored
232 try:
ab55682 @liftoff IMPORTANT PACKAGING CHANGE: /opt/gateone is no more! See the commit me...
authored
233 out = slimit.minify(data)
234 with open(gateone_min_js, 'wb') as f:
235 f.write(out)
236 f.write('\n//# sourceURL=/static/gateone.js\n')
237 except Exception as e:
238 print("Got an exception trying to minify gateone.js; skipping")
d214f91 @liftoff NOTE: Lots of tidying-up in this commit. Functions were moved around a...
authored
239 #import traceback
240 #traceback.print_exc(file=sys.stdout)
ab55682 @liftoff IMPORTANT PACKAGING CHANGE: /opt/gateone is no more! See the commit me...
authored
241 except ImportError:
242 pass
6c5d163 @liftoff onoff.py: Added some use of the logging module for debugging purposes.
authored
243
24a0aff @liftoff INSTALL.txt: Updated to reflect the new packaging locations and whatnot...
authored
244 class FixInitPaths(install):
245 """
246 An override of the `setuptools.command.install.install` cmdclass to ensure
247 the paths to 'gateone' are correct in any init scripts.
248 """
249 def finalize_options(self):
250 """
251 Calls the regular ``finalize_options()`` method and adjusts the path to
252 the 'gateone' script inside init scripts, .conf, and .service files.
253 """
254 install.finalize_options(self)
1528d32 @liftoff NOTE: YOU MAY HAVE TO REMOVE/REINSTALL GATE ONE (see setup.py notes bel...
authored
255 if skip_init:
256 return
24a0aff @liftoff INSTALL.txt: Updated to reflect the new packaging locations and whatnot...
authored
257 gateone_path = os.path.join(self.install_scripts, 'gateone')
258 if os.path.exists(temp_script_path):
259 with io.open(temp_script_path, encoding='utf-8') as f:
260 temp = f.read()
261 temp = temp.replace('GATEONE=gateone', 'GATEONE=%s' % gateone_path)
262 with io.open(temp_script_path, 'w', encoding='utf-8') as f:
263 f.write(temp)
264 if os.path.exists(upstart_temp_path):
265 with io.open(upstart_temp_path, encoding='utf-8') as f:
266 temp = f.read()
267 temp = temp.replace('exec gateone', 'exec %s' % gateone_path)
268 with io.open(upstart_temp_path, 'w', encoding='utf-8') as f:
269 f.write(temp)
270 if os.path.exists(systemd_temp_path):
271 with io.open(systemd_temp_path, encoding='utf-8') as f:
272 temp = f.read()
273 temp = temp.replace(
274 'ExecStart=gateone', 'ExecStart=%s' % gateone_path)
275 with io.open(systemd_temp_path, 'w', encoding='utf-8') as f:
276 f.write(temp)
68c3ef6 @liftoff Improved the FreeBSD init script support in setup.py. It will now autom...
authored
277 if os.path.exists(bsd_temp_script):
278 with io.open(bsd_temp_script, encoding='utf-8') as f:
279 temp = f.read()
280 temp = temp.replace(
281 'command=gateone', 'command=%s' % gateone_path)
282 with io.open(bsd_temp_script, 'w', encoding='utf-8') as f:
283 f.write(temp)
24a0aff @liftoff INSTALL.txt: Updated to reflect the new packaging locations and whatnot...
authored
284
04f2eab @liftoff Commit #1: The Gate One beta is about to go public.
authored
285 setup(
286 name = 'gateone',
24a0aff @liftoff INSTALL.txt: Updated to reflect the new packaging locations and whatnot...
authored
287 cmdclass = {'build_py': build_py, 'install': FixInitPaths},
04f2eab @liftoff Commit #1: The Gate One beta is about to go public.
authored
288 license = 'AGPLv3 or Proprietary',
289 version = version,
290 description = 'Web-based Terminal Emulator and SSH Client',
291 long_description = (
0dfa419 @liftoff Made a few minor changes to setup.py, setup.cfg, and added a stdeb.cfg t...
authored
292 'Gate One is a web-based terminal emulator and SSH client that requires'
293 ' no browser plugins and includes many unique and advanced features.'),
04f2eab @liftoff Commit #1: The Gate One beta is about to go public.
authored
294 classifiers = [
0dfa419 @liftoff Made a few minor changes to setup.py, setup.cfg, and added a stdeb.cfg t...
authored
295 "Development Status :: 5 - Production/Stable",
fe1287b @liftoff TORNADO 2.2 IS OUT. This version is now required to use Gate One as it ...
authored
296 "Operating System :: Unix",
297 "Environment :: Console",
298 "Environment :: Web Environment",
299 "Intended Audience :: End Users/Desktop",
300 "Intended Audience :: Developers",
301 "Intended Audience :: System Administrators",
302 # NOTE: Wish there was a "Tornado" framework option
303 "Programming Language :: Python :: 2.6",
80aa41e @liftoff terminal.js: Added GateOne.Terminal.clearScrollback(term); it just empt...
authored
304 "Programming Language :: Python :: 2.7",
305 "Programming Language :: Python :: 3.2",
306 "Programming Language :: Python :: 3.3",
fe1287b @liftoff TORNADO 2.2 IS OUT. This version is now required to use Gate One as it ...
authored
307 "License :: OSI Approved :: GNU Affero General Public License v3",
308 "License :: Other/Proprietary License",
309 "Topic :: Internet :: WWW/HTTP",
310 "Topic :: Terminals"
04f2eab @liftoff Commit #1: The Gate One beta is about to go public.
authored
311 ], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
fe1287b @liftoff TORNADO 2.2 IS OUT. This version is now required to use Gate One as it ...
authored
312 keywords = (
313 'web administration terminal vt100 xterm emulation html5 console '
314 'web-to-host'),
315 url = "http:/liftoffsoftware.com/Products/GateOne",
04f2eab @liftoff Commit #1: The Gate One beta is about to go public.
authored
316 author = 'Dan McDougall',
317 author_email = 'daniel.mcdougall@liftoffsoftware.com',
24a0aff @liftoff INSTALL.txt: Updated to reflect the new packaging locations and whatnot...
authored
318 install_requires = requires,
d214f91 @liftoff NOTE: Lots of tidying-up in this commit. Functions were moved around a...
authored
319 zip_safe = False, # TODO: Convert everything to using pkg_resources
ab55682 @liftoff IMPORTANT PACKAGING CHANGE: /opt/gateone is no more! See the commit me...
authored
320 py_modules = ["gateone"],
f9e8971 @liftoff GATE ONE HAS NOW BEEN TRANSLATED (probably badly) into: German, Portugeu...
authored
321 entry_points = entry_points,
ab55682 @liftoff IMPORTANT PACKAGING CHANGE: /opt/gateone is no more! See the commit me...
authored
322 provides = ['gateone', 'termio', 'terminal', 'onoff'],
323 packages = packages,
0c26ebc @liftoff utils.py: A minor fix for Python 3 compatibility in the valid_hostname(...
authored
324 data_files = data_files,
325 **extra
2aecefa @liftoff PYTHON 3 SUPPORT HAS BEEN ADDED!
authored
326 )
327
17c822e @liftoff setup.py: Added some code that fixes the shebang in ssh_connect.py when...
authored
328 # For whatever reason 2to3 doesn't fix the shebang in the ssh_connect.py
329 # script on systems with both python2 and python3. Double-check that and fix it
330 # if needed:
331 if PYTHON3:
332 # We only need to fix the shebang if the 'python' executable is Python 2.X
333 retcode, output = getstatusoutput('python --version')
334 if output.split()[1].startswith('2'):
335 for path in sys.path:
336 try:
337 files = os.listdir(path)
338 except NotADirectoryError:
339 continue
340 for f in files:
341 if 'gateone' in f: # Found an installation
342 ssh_connect = os.path.join(
343 path, f, 'gateone', 'applications', 'terminal',
344 'plugins', 'ssh', 'scripts', 'ssh_connect.py')
345 if setup_dir in ssh_connect:
346 continue # Don't mess with the downloaded code
347 if not os.path.exists(ssh_connect):
348 # Alternate location on some systems:
349 ssh_connect = os.path.join(
350 path, f, 'applications', 'terminal', 'plugins',
351 'ssh', 'scripts', 'ssh_connect.py')
352 if os.path.exists(ssh_connect):
353 new_ssh_connect = b''
354 for i, line in enumerate(open(ssh_connect, 'rb')):
355 if i == 0 and not line.strip().endswith(b'python3'):
356 print(
357 "Changing shebang to use 'python3' in %s" %
358 ssh_connect)
359 new_ssh_connect += b'#!/usr/bin/env python3\n'
360 else:
361 new_ssh_connect += line
362 with open(ssh_connect, 'wb') as new_ssh_c:
363 new_ssh_c.write(new_ssh_connect)
364
c41a6ca @liftoff core/server.py: `ApplicationWebSocket.set_locale()` has been renamed to...
authored
365 print("Entry points were created for the following:")
366 for ep, items in sorted(list(entry_points.items())):
367 print(" %s" % ep)
368 for item in sorted(items):
369 print(" %s" % item)
370
24a0aff @liftoff INSTALL.txt: Updated to reflect the new packaging locations and whatnot...
authored
371 if not os.path.exists('/opt/gateone'):
372 # Don't bother printing out the migration info below if the user has never
373 # installed Gate One on this system before.
374 sys.exit(0)
375
ab55682 @liftoff IMPORTANT PACKAGING CHANGE: /opt/gateone is no more! See the commit me...
authored
376 print("""
377 \x1b[1mIMPORTANT:\x1b[0m Gate One has been relocated from /opt/gateone to your
378 system's site-packages directory. The old location was left alone. You may
379 now start Gate One by simply running 'gateone' (it should be in your $PATH).
380
381 \x1b[1mImportant default file locations (and their respective cli args):\x1b[0m
382
383 \x1b[1m--settings_dir\x1b[0m=/etc/gateone/conf.d
384 \x1b[1m--certificate\x1b[0m=/etc/gateone/ssl/certificate.pem
385 \x1b[1m--keyfile\x1b[0m=/etc/gateone/ssl/keyfile.pem
386 \x1b[1m--user_dir\x1b[0m=/var/lib/gateone/users
387 \x1b[1m--log_file_prefix\x1b[0m=/var/log/gateone/gateone.log
388 \x1b[1m--pid_file\x1b[0m=/var/run/gateone.pid
389 """)
390
391 if os.path.exists('/opt/gateone/settings'):
392 print("""\
393 \x1b[1mTIP:\x1b[0m If you wish to preserve your old settings:
d214f91 @liftoff NOTE: Lots of tidying-up in this commit. Functions were moved around a...
authored
394 sudo mkdir -p /etc/gateone
395 sudo mv /opt/gateone/settings /etc/gateone/conf.d""")
Something went wrong with that request. Please try again.