@@ -502,7 +502,7 @@ import os
502
502
503
503
from jupyter_packaging import (
504
504
create_cmdclass , install_npm , ensure_targets ,
505
- combine_commands , get_version ,
505
+ combine_commands , skip_if_exists
506
506
)
507
507
import setuptools
508
508
@@ -519,7 +519,6 @@ lab_path = os.path.join(HERE, name, "labextension")
519
519
520
520
# Representative files that should exist after a successful build
521
521
jstargets = [
522
- os .path .join (HERE , " lib" , " index.js" ),
523
522
os .path .join (lab_path , " package.json" ),
524
523
]
525
524
@@ -535,19 +534,25 @@ data_files_spec = [
535
534
(" share/jupyter/labextensions/%s" % labext_name , lab_path , " **" ),
536
535
(" share/jupyter/labextensions/%s" % labext_name , HERE , " install.json" ),(" etc/jupyter/jupyter_server_config.d" ,
537
536
" jupyter-config" , " jlab_ext_example.json" ),
538
-
537
+
539
538
]
540
539
541
540
cmdclass = create_cmdclass (" jsdeps" ,
542
541
package_data_spec =package_data_spec ,
543
542
data_files_spec =data_files_spec
544
543
)
545
544
546
- cmdclass [ " jsdeps " ] = combine_commands (
545
+ js_command = combine_commands (
547
546
install_npm (HERE , build_cmd =" build:prod" , npm =[" jlpm" ]),
548
547
ensure_targets (jstargets ),
549
548
)
550
549
550
+ is_repo = os .path .exists (os .path .join (HERE , " .git" ))
551
+ if is_repo :
552
+ cmdclass [" jsdeps" ] = js_command
553
+ else :
554
+ cmdclass [" jsdeps" ] = skip_if_exists (jstargets , js_command )
555
+
551
556
with open (" README.md" , " r" ) as fh :
552
557
long_description = fh .read ()
553
558
@@ -562,14 +567,14 @@ setup_args = dict(
562
567
cmdclass = cmdclass ,
563
568
packages =setuptools .find_packages (),
564
569
install_requires =[
565
- " jupyterlab>=3.0.0rc2 ,==3.*" ,
570
+ " jupyterlab>=3.0.0rc15 ,==3.*" ,
566
571
],
567
572
zip_safe =False ,
568
573
include_package_data =True ,
569
574
python_requires =" >=3.6" ,
570
575
license =" BSD-3-Clause" ,
571
576
platforms =" Linux, Mac OS X, Windows" ,
572
- keywords =[" Jupyter" , " JupyterLab" ],
577
+ keywords =[" Jupyter" , " JupyterLab" , " JupyterLab3 " ],
573
578
classifiers =[
574
579
" License :: OSI Approved :: BSD License" ,
575
580
" Programming Language :: Python" ,
@@ -593,14 +598,14 @@ the frontend NPM package needs to be built and inserted in the Python package. T
593
598
done using a special ` cmdclass ` :
594
599
595
600
` ` ` py
596
- # setup .py #L45 - L53
601
+ # setup .py #L44 - L52
597
602
598
603
cmdclass = create_cmdclass (" jsdeps" ,
599
604
package_data_spec =package_data_spec ,
600
605
data_files_spec =data_files_spec
601
606
)
602
607
603
- cmdclass [ " jsdeps " ] = combine_commands (
608
+ js_command = combine_commands (
604
609
install_npm (HERE , build_cmd =" build:prod" , npm =[" jlpm" ]),
605
610
ensure_targets (jstargets ),
606
611
)
@@ -609,18 +614,18 @@ cmdclass["jsdeps"] = combine_commands(
609
614
Basically it will build the frontend NPM package:
610
615
611
616
` ` ` py
612
- # setup .py #L51 - L51
617
+ # setup .py #L50 - L50
613
618
614
619
install_npm (HERE , build_cmd =" build:prod" , npm =[" jlpm" ]),
615
620
` ` `
616
621
617
622
It will ensure one of the generated JS files is ` lib /jlabextexample .js ` :
618
623
619
624
` ` ` py
620
- # setup .py #L25 - L28
625
+ # setup .py #L24 - L27
621
626
627
+ # Representative files that should exist after a successful build
622
628
jstargets = [
623
- os .path .join (HERE , " lib" , " index.js" ),
624
629
os .path .join (lab_path , " package.json" ),
625
630
]
626
631
` ` `
0 commit comments