Bump Python support to 3.4 and up

This commit is contained in:
Carol Willing
2017-07-19 14:57:52 -07:00
parent 738976a956
commit d34f6e779d
3 changed files with 32 additions and 22 deletions

View File

@@ -53,7 +53,7 @@ for administration of the Hub and its users.
A Linux/Unix based system with the following: A Linux/Unix based system with the following:
- [Python](https://www.python.org/downloads/) 3.3 or greater - [Python](https://www.python.org/downloads/) 3.4 or greater
- [nodejs/npm](https://www.npmjs.com/) Install a recent version of - [nodejs/npm](https://www.npmjs.com/) Install a recent version of
[nodejs/npm](https://docs.npmjs.com/getting-started/installing-node) [nodejs/npm](https://docs.npmjs.com/getting-started/installing-node)
For example, install it on Linux (Debian/Ubuntu) using: For example, install it on Linux (Debian/Ubuntu) using:

View File

@@ -7,6 +7,16 @@ command line for details.
## [Unreleased] 0.8 ## [Unreleased] 0.8
#### Added
#### Changed
#### Fixed
#### Removed
- End support for Python 3.3
## 0.7 ## 0.7
### [0.7.2] - 2017-01-09 ### [0.7.2] - 2017-01-09

View File

@@ -15,8 +15,8 @@ import shutil
import sys import sys
v = sys.version_info v = sys.version_info
if v[:2] < (3,3): if v[:2] < (3,4):
error = "ERROR: JupyterHub requires Python version 3.3 or above." error = "ERROR: JupyterHub requires Python version 3.4 or above."
print(error, file=sys.stderr) print(error, file=sys.stderr)
sys.exit(1) sys.exit(1)
@@ -49,10 +49,10 @@ is_repo = os.path.exists(pjoin(here, '.git'))
def get_data_files(): def get_data_files():
"""Get data files in share/jupyter""" """Get data files in share/jupyter"""
data_files = [] data_files = []
ntrim = len(here + os.path.sep) ntrim = len(here + os.path.sep)
for (d, dirs, filenames) in os.walk(share_jupyter): for (d, dirs, filenames) in os.walk(share_jupyter):
data_files.append(( data_files.append((
d[ntrim:], d[ntrim:],
@@ -134,27 +134,27 @@ def mtime(path):
class BaseCommand(Command): class BaseCommand(Command):
"""Dumb empty command because Command needs subclasses to override too much""" """Dumb empty command because Command needs subclasses to override too much"""
user_options = [] user_options = []
def initialize_options(self): def initialize_options(self):
pass pass
def finalize_options(self): def finalize_options(self):
pass pass
def get_inputs(self): def get_inputs(self):
return [] return []
def get_outputs(self): def get_outputs(self):
return [] return []
class Bower(BaseCommand): class Bower(BaseCommand):
description = "fetch static client-side components with bower" description = "fetch static client-side components with bower"
user_options = [] user_options = []
bower_dir = pjoin(static, 'components') bower_dir = pjoin(static, 'components')
node_modules = pjoin(here, 'node_modules') node_modules = pjoin(here, 'node_modules')
def should_run(self): def should_run(self):
if not os.path.exists(self.bower_dir): if not os.path.exists(self.bower_dir):
return True return True
@@ -167,17 +167,17 @@ class Bower(BaseCommand):
if not os.path.exists(self.node_modules): if not os.path.exists(self.node_modules):
return True return True
return mtime(self.node_modules) < mtime(pjoin(here, 'package.json')) return mtime(self.node_modules) < mtime(pjoin(here, 'package.json'))
def run(self): def run(self):
if not self.should_run(): if not self.should_run():
print("bower dependencies up to date") print("bower dependencies up to date")
return return
if self.should_run_npm(): if self.should_run_npm():
print("installing build dependencies with npm") print("installing build dependencies with npm")
check_call(['npm', 'install', '--progress=false'], cwd=here, shell=shell) check_call(['npm', 'install', '--progress=false'], cwd=here, shell=shell)
os.utime(self.node_modules) os.utime(self.node_modules)
env = os.environ.copy() env = os.environ.copy()
env['PATH'] = npm_path env['PATH'] = npm_path
args = ['bower', 'install', '--allow-root', '--config.interactive=false'] args = ['bower', 'install', '--allow-root', '--config.interactive=false']
@@ -194,11 +194,11 @@ class Bower(BaseCommand):
class CSS(BaseCommand): class CSS(BaseCommand):
description = "compile CSS from LESS" description = "compile CSS from LESS"
def should_run(self): def should_run(self):
"""Does less need to run?""" """Does less need to run?"""
# from IPython.html.tasks.py # from IPython.html.tasks.py
css_targets = [pjoin(static, 'css', 'style.min.css')] css_targets = [pjoin(static, 'css', 'style.min.css')]
css_maps = [t + '.map' for t in css_targets] css_maps = [t + '.map' for t in css_targets]
targets = css_targets + css_maps targets = css_targets + css_maps
@@ -206,7 +206,7 @@ class CSS(BaseCommand):
# some generated files don't exist # some generated files don't exist
return True return True
earliest_target = sorted(mtime(t) for t in targets)[0] earliest_target = sorted(mtime(t) for t in targets)[0]
# check if any .less files are newer than the generated targets # check if any .less files are newer than the generated targets
for (dirpath, dirnames, filenames) in os.walk(static): for (dirpath, dirnames, filenames) in os.walk(static):
for f in filenames: for f in filenames:
@@ -215,20 +215,20 @@ class CSS(BaseCommand):
timestamp = mtime(path) timestamp = mtime(path)
if timestamp > earliest_target: if timestamp > earliest_target:
return True return True
return False return False
def run(self): def run(self):
if not self.should_run(): if not self.should_run():
print("CSS up-to-date") print("CSS up-to-date")
return return
self.run_command('js') self.run_command('js')
style_less = pjoin(static, 'less', 'style.less') style_less = pjoin(static, 'less', 'style.less')
style_css = pjoin(static, 'css', 'style.min.css') style_css = pjoin(static, 'css', 'style.min.css')
sourcemap = style_css + '.map' sourcemap = style_css + '.map'
env = os.environ.copy() env = os.environ.copy()
env['PATH'] = npm_path env['PATH'] = npm_path
args = [ args = [