# encoding: utf-8 """ This module defines the things that are used in setup.py for building JupyterLab This includes: * Functions for finding things like packages, package data, etc. * A function for checking dependencies. """ # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import os import pipes import sys from distutils import log from setuptools.command.bdist_egg import bdist_egg from subprocess import check_call if sys.platform == 'win32': from subprocess import list2cmdline else: def list2cmdline(cmd_list): return ' '.join(map(pipes.quote, cmd_list)) here = os.path.dirname(os.path.abspath(__file__)) is_repo = os.path.exists(os.path.join(here, '.git')) def run(cmd, *args, **kwargs): """Echo a command before running it""" log.info('> ' + list2cmdline(cmd)) kwargs['shell'] = (sys.platform == 'win32') return check_call(cmd, *args, **kwargs) #--------------------------------------------------------------------------- # Find packages #--------------------------------------------------------------------------- def find_packages(): """ Find all of the packages. """ packages = [] for dir, subdirs, files in os.walk('jupyterlab'): package = dir.replace(os.path.sep, '.') if '__init__.py' not in files: # not a package continue packages.append(package) return packages #--------------------------------------------------------------------------- # Find package data #--------------------------------------------------------------------------- def find_package_data(): """ Find package_data. """ return { 'jupyterlab': ['static/*', 'lab.html', 'package.json', 'index.template.js', 'webpack.config.js'] } 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.")