always install with setuptools

but not eggs (effectively require pip install .)
This commit is contained in:
Min RK
2016-09-05 15:46:20 +02:00
parent acb49adfea
commit 9aa4046093

View File

@@ -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,17 +264,27 @@ 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):