-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6624b59
commit d7e04e1
Showing
6 changed files
with
98 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
recursive-include tljh_repo2docker/templates/ * | ||
recursive-include tljh_repo2docker/static/ * | ||
recursive-include tljh_repo2docker/tests/ * | ||
recursive-include frontend/ * | ||
|
||
prune frontend/node_modules | ||
prune frontend/lib | ||
prune frontend/.yarn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,83 @@ | ||
from setuptools import setup, find_packages | ||
import shutil | ||
from pathlib import Path | ||
from subprocess import check_call | ||
|
||
from setuptools import Command, find_packages, setup | ||
from setuptools.command.build_py import build_py | ||
from setuptools.command.develop import develop | ||
from setuptools.command.sdist import sdist | ||
|
||
here = Path(__file__).parent | ||
|
||
|
||
class BaseCommand(Command): | ||
"""Copy from https://github.com/jupyterhub/jupyterhub/blob/main/setup.py#L62""" | ||
|
||
user_options = [] | ||
|
||
def initialize_options(self): | ||
pass | ||
|
||
def finalize_options(self): | ||
pass | ||
|
||
def get_inputs(self): | ||
return [] | ||
|
||
def get_outputs(self): | ||
return [] | ||
|
||
|
||
class BuildFrontend(BaseCommand): | ||
description = "build React app" | ||
frontend_dir = str(here / "frontend") | ||
|
||
def run(self): | ||
if not shutil.which("yarn"): | ||
raise Exception("yarn is not installed!") | ||
|
||
check_call( | ||
["yarn", "install"], | ||
cwd=self.frontend_dir, | ||
) | ||
|
||
check_call( | ||
["yarn", "clean"], | ||
cwd=self.frontend_dir, | ||
) | ||
|
||
check_call( | ||
["yarn", "run", "build:prod"], | ||
cwd=self.frontend_dir, | ||
) | ||
|
||
|
||
def command_with_build_frontend(Cls): | ||
class CommandWithBuildFrontend(Cls): | ||
|
||
def run(self): | ||
self.run_command("build_frontend") | ||
|
||
return super().run() | ||
|
||
return CommandWithBuildFrontend | ||
|
||
setup( | ||
name="tljh-repo2docker", | ||
version="0.0.1", | ||
entry_points={"tljh": ["tljh_repo2docker = tljh_repo2docker"]}, | ||
packages=find_packages(), | ||
include_package_data=True, | ||
install_requires=["dockerspawner~=12.1", "jupyter_client~=6.1", "aiodocker~=0.19", "sqlalchemy<2"], | ||
install_requires=[ | ||
"dockerspawner~=12.1", | ||
"jupyter_client~=6.1", | ||
"aiodocker~=0.19", | ||
"sqlalchemy<2", | ||
], | ||
cmdclass={ | ||
"build_frontend": BuildFrontend, | ||
"develop": command_with_build_frontend(develop), | ||
'build_py': command_with_build_frontend(build_py), | ||
'sdist': command_with_build_frontend(sdist), | ||
}, | ||
) |