mirror of
https://github.com/jupyter/notebook.git
synced 2025-02-11 12:30:51 +08:00
run check_package_data as part of build_py
rather than explicitly in setup.py
This commit is contained in:
parent
c79134f2d9
commit
17d5c263a8
13
setup.py
13
setup.py
@ -58,7 +58,7 @@ from setupbase import (
|
||||
setup_args,
|
||||
find_packages,
|
||||
find_package_data,
|
||||
check_package_data,
|
||||
check_package_data_first,
|
||||
find_entry_points,
|
||||
build_scripts_entrypt,
|
||||
find_data_files,
|
||||
@ -199,15 +199,6 @@ setup_args['packages'] = packages
|
||||
setup_args['package_data'] = package_data
|
||||
setup_args['data_files'] = data_files
|
||||
|
||||
def maybe_check_package_data():
|
||||
for should_check in ('bdist', 'sdist', 'build', 'install'):
|
||||
for arg in sys.argv:
|
||||
if arg.startswith(should_check):
|
||||
check_package_data(package_data)
|
||||
return
|
||||
|
||||
maybe_check_package_data()
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# custom distutils commands
|
||||
#---------------------------------------------------------------------------
|
||||
@ -235,7 +226,7 @@ class UploadWindowsInstallers(upload):
|
||||
self.upload_file('bdist_wininst', 'any', dist_file)
|
||||
|
||||
setup_args['cmdclass'] = {
|
||||
'build_py': git_prebuild('IPython'),
|
||||
'build_py': check_package_data_first(git_prebuild('IPython')),
|
||||
'sdist' : git_prebuild('IPython', sdist),
|
||||
'upload_wininst' : UploadWindowsInstallers,
|
||||
'submodule' : UpdateSubmodules,
|
||||
|
13
setupbase.py
13
setupbase.py
@ -190,6 +190,7 @@ def find_package_data():
|
||||
|
||||
return package_data
|
||||
|
||||
|
||||
def check_package_data(package_data):
|
||||
"""verify that package_data globs make sense"""
|
||||
print("checking package data")
|
||||
@ -203,6 +204,18 @@ def check_package_data(package_data):
|
||||
assert os.path.exists(path), "Missing package data: %s" % path
|
||||
|
||||
|
||||
def check_package_data_first(command):
|
||||
"""decorator for checking package_data before running a given command
|
||||
|
||||
Probably only needs to wrap build_py
|
||||
"""
|
||||
class DecoratedCommand(command):
|
||||
def run(self):
|
||||
check_package_data(self.package_data)
|
||||
command.run(self)
|
||||
return DecoratedCommand
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Find data files
|
||||
#---------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user