mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-07 10:04:07 +00:00
always install with setuptools
but not eggs (effectively require pip install .)
This commit is contained in:
36
setup.py
36
setup.py
@@ -28,12 +28,12 @@ if os.name in ('nt', 'dos'):
|
|||||||
# At least we're on the python version we need, move on.
|
# At least we're on the python version we need, move on.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from glob import glob
|
from glob import glob
|
||||||
|
|
||||||
from distutils.core import setup
|
|
||||||
from subprocess import check_call
|
from subprocess import check_call
|
||||||
|
|
||||||
|
from setuptools import setup
|
||||||
|
from setuptools.command.bdist_egg import bdist_egg
|
||||||
|
|
||||||
pjoin = os.path.join
|
pjoin = os.path.join
|
||||||
|
|
||||||
here = os.path.abspath(os.path.dirname(__file__))
|
here = os.path.abspath(os.path.dirname(__file__))
|
||||||
@@ -46,11 +46,6 @@ is_repo = os.path.exists(pjoin(here, '.git'))
|
|||||||
# Build basic package data, etc.
|
# Build basic package data, etc.
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
# setuptools for wheel, develop
|
|
||||||
for cmd in ['bdist_wheel', 'develop']:
|
|
||||||
if cmd in sys.argv:
|
|
||||||
import setuptools
|
|
||||||
|
|
||||||
def get_data_files():
|
def get_data_files():
|
||||||
"""Get data files in share/jupyter"""
|
"""Get data files in share/jupyter"""
|
||||||
|
|
||||||
@@ -70,7 +65,6 @@ def get_package_data():
|
|||||||
(mostly alembic config)
|
(mostly alembic config)
|
||||||
"""
|
"""
|
||||||
package_data = {}
|
package_data = {}
|
||||||
pkg = pjoin(here, 'jupyterhub')
|
|
||||||
package_data['jupyterhub'] = [
|
package_data['jupyterhub'] = [
|
||||||
'alembic/*',
|
'alembic/*',
|
||||||
'alembic/versions/*',
|
'alembic/versions/*',
|
||||||
@@ -270,29 +264,39 @@ def js_css_first(cls, strict=True):
|
|||||||
return Command
|
return Command
|
||||||
|
|
||||||
|
|
||||||
|
class bdist_egg_disabled(bdist_egg):
|
||||||
|
"""Disabled version of bdist_egg
|
||||||
|
|
||||||
|
Prevents setup.py install performing setuptools' default easy_install,
|
||||||
|
which it should never ever do.
|
||||||
|
"""
|
||||||
|
def run(self):
|
||||||
|
sys.exit("Aborting implicit building of eggs. Use `pip install .` to install from source.")
|
||||||
|
|
||||||
|
|
||||||
setup_args['cmdclass'] = {
|
setup_args['cmdclass'] = {
|
||||||
'js': Bower,
|
'js': Bower,
|
||||||
'css': CSS,
|
'css': CSS,
|
||||||
'build_py': js_css_first(build_py, strict=is_repo),
|
'build_py': js_css_first(build_py, strict=is_repo),
|
||||||
'sdist': js_css_first(sdist, strict=True),
|
'sdist': js_css_first(sdist, strict=True),
|
||||||
|
'bdist_egg': bdist_egg if 'bdist_egg' in sys.argv else bdist_egg_disabled,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# setuptools requirements
|
# setuptools requirements
|
||||||
|
|
||||||
if 'setuptools' in sys.modules:
|
setup_args['zip_safe'] = False
|
||||||
setup_args['zip_safe'] = False
|
from setuptools.command.develop import develop
|
||||||
from setuptools.command.develop import develop
|
class develop_js_css(develop):
|
||||||
class develop_js_css(develop):
|
|
||||||
def run(self):
|
def run(self):
|
||||||
if not self.uninstall:
|
if not self.uninstall:
|
||||||
self.distribution.run_command('js')
|
self.distribution.run_command('js')
|
||||||
self.distribution.run_command('css')
|
self.distribution.run_command('css')
|
||||||
develop.run(self)
|
develop.run(self)
|
||||||
setup_args['cmdclass']['develop'] = develop_js_css
|
setup_args['cmdclass']['develop'] = develop_js_css
|
||||||
setup_args['install_requires'] = install_requires = []
|
setup_args['install_requires'] = install_requires = []
|
||||||
|
|
||||||
with open('requirements.txt') as f:
|
with open('requirements.txt') as f:
|
||||||
for line in f.readlines():
|
for line in f.readlines():
|
||||||
req = line.strip()
|
req = line.strip()
|
||||||
if not req or req.startswith('#') or '://' in req:
|
if not req or req.startswith('#') or '://' in req:
|
||||||
|
Reference in New Issue
Block a user