Skip to content

Commit 71b98e3

Browse files
Added the CMake Install Command (#8)
* docker_cli -> WIGWAM * Added `cmake-install` command * tiny fix * PR fixes + Added documentation for why to use USER root in cmake install + Added a check for the case where an image uses 'lib' and not 'lib64' + Added PYTHONPATH env variable change in cmake install ~ Changed some documentation in cmake install - Remove workdir change in cmake install * Added unit test, fixed libdir bug --------- Co-authored-by: tyler-g-hudson <[email protected]>
1 parent 54ce6da commit 71b98e3

38 files changed

+196
-48
lines changed

test/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import sys
33
from pathlib import Path
44

5-
from docker_cli.commands import remove
5+
from wigwam.commands import remove
66

77
# This import is necessary for the fixtures to be visible to the test files.
88
# Importing fixtures directly into a file can cause some non-trivial problems with
@@ -20,7 +20,7 @@ def pytest_sessionstart(session):
2020
os.chdir(Path(__file__).parent)
2121

2222
# Set the system to look for files in the repository root path so it can see the
23-
# docker_cli module without having to install it.
23+
# wigwam module without having to install it.
2424
sys.path.insert(0, str(Path(__file__).parents[1]))
2525

2626

test/fixtures.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
from pytest import fixture
88

9-
from docker_cli import Image, PackageManager, URLReader
10-
from docker_cli._docker_init import init_dockerfile
11-
from docker_cli._utils import image_command_check, temp_image
9+
from wigwam import Image, PackageManager, URLReader
10+
from wigwam._docker_init import init_dockerfile
11+
from wigwam._utils import image_command_check, temp_image
1212

1313
from .utils import determine_scope, generate_tag, remove_docker_image
1414

test/fixtures_isce3.py

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@
77

88
from pytest import fixture
99

10-
from docker_cli import Image, URLReader
11-
from docker_cli._docker_cmake import cmake_build_dockerfile, cmake_config_dockerfile
12-
from docker_cli._docker_git import git_extract_dockerfile
13-
from docker_cli.setup_commands import setup_all
10+
from wigwam import Image, URLReader
11+
from wigwam._docker_cmake import (
12+
cmake_build_dockerfile,
13+
cmake_config_dockerfile,
14+
cmake_install_dockerfile,
15+
)
16+
from wigwam._docker_git import git_extract_dockerfile
17+
from wigwam.setup_commands import setup_all
1418

1519
from .utils import determine_scope, generate_tag, remove_docker_image
1620

@@ -110,7 +114,7 @@ def isce3_git_repo_image(
110114
tag=isce3_git_repo_tag, dockerfile_string=dockerfile, no_cache=False
111115
)
112116

113-
remove_docker_image(isce3_git_repo_image)
117+
remove_docker_image(isce3_git_repo_tag)
114118

115119

116120
@fixture(scope=determine_scope)
@@ -162,4 +166,28 @@ def isce3_cmake_build_image(
162166
tag=isce3_cmake_build_tag, dockerfile_string=dockerfile, no_cache=False
163167
)
164168

165-
remove_docker_image(isce3_cmake_config_tag)
169+
remove_docker_image(isce3_cmake_build_tag)
170+
171+
172+
@fixture(scope=determine_scope)
173+
def isce3_cmake_install_tag() -> str:
174+
"""Return a tag for the ISCE3 CMake install image."""
175+
return generate_tag("isce3-cmake-install")
176+
177+
178+
@fixture(scope=determine_scope)
179+
def isce3_cmake_install_image(
180+
isce3_cmake_install_tag: str,
181+
isce3_cmake_build_tag: str,
182+
isce3_cmake_build_image: Image, # type: ignore
183+
) -> Iterator[Image]:
184+
"""Return the ISCE3 CMake install image."""
185+
dockerfile = cmake_install_dockerfile(base=isce3_cmake_build_tag)
186+
187+
yield Image.build(
188+
tag=isce3_cmake_install_tag,
189+
dockerfile_string=dockerfile,
190+
no_cache=False,
191+
)
192+
193+
remove_docker_image(isce3_cmake_install_tag)

test/test_bind_mount.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from pytest import raises
22

3-
from docker_cli._bind_mount import BindMount
3+
from wigwam._bind_mount import BindMount
44

55

66
def test_mount_init():

test/test_docker_cmake.py

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@
55

66
from pytest import fixture, mark
77

8-
from docker_cli import Image, mamba_install_dockerfile
9-
from docker_cli._docker_cmake import cmake_build_dockerfile, cmake_config_dockerfile
8+
from wigwam import Image, mamba_install_dockerfile
9+
from wigwam._docker_cmake import (
10+
cmake_build_dockerfile,
11+
cmake_config_dockerfile,
12+
cmake_install_dockerfile,
13+
)
1014

1115
from .utils import (
1216
determine_scope,
@@ -216,13 +220,17 @@ def test_cmake_config_dockerfile(
216220
rough_dockerfile_validity_check(example_cmake_config_dockerfile)
217221

218222
@mark.dockerfiles
219-
def test_cmake_build_dockerfile(
220-
self,
221-
):
223+
def test_cmake_build_dockerfile(self):
222224
"""Tests the CMake build dockerfiles generated by the system."""
223225
dockerfile = cmake_build_dockerfile(base="abc")
224226
rough_dockerfile_validity_check(dockerfile=dockerfile)
225227

228+
@mark.dockerfiles
229+
def test_cmake_install_dockerfile(self):
230+
"""Tests the CMake build dockerfiles generated by the system."""
231+
dockerfile = cmake_install_dockerfile(base="abc")
232+
rough_dockerfile_validity_check(dockerfile=dockerfile)
233+
226234
@mark.images
227235
class TestCMakeImages:
228236
def test_cmake_config_build(
@@ -266,3 +274,18 @@ def test_cmake_build_image(
266274
ISCE3 base images.
267275
"""
268276
isce3_cmake_build_image.run(command="test cxx/isce3/libisce3.so")
277+
278+
@mark.isce3
279+
@mark.slow
280+
def test_cmake_install_image(
281+
self,
282+
isce3_cmake_install_image: Image,
283+
):
284+
"""
285+
Test the CMake install image.
286+
287+
NOTE: This test runs very slowly because it requires the building of all
288+
ISCE3 base images.
289+
"""
290+
isce3_cmake_install_image.run(command='python -c "import isce3"')
291+
isce3_cmake_install_image.run(command='python -c "import nisar"')

test/test_docker_cuda.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
from pytest import fixture, mark
44

5-
from docker_cli import Image
6-
from docker_cli._docker_cuda import (
5+
from wigwam import Image
6+
from wigwam._docker_cuda import (
77
AptGetCUDADockerfileGen,
88
CUDADockerfileGenerator,
99
YumCUDADockerfileGen,
1010
get_cuda_dockerfile_generator,
1111
)
12-
from docker_cli._package_manager import AptGet, PackageManager, Yum
13-
from docker_cli._url_reader import Curl, URLReader, Wget
12+
from wigwam._package_manager import AptGet, PackageManager, Yum
13+
from wigwam._url_reader import Curl, URLReader, Wget
1414

1515
from .utils import (
1616
determine_scope,

test/test_docker_git.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
from pytest import mark
55

6-
from docker_cli._docker_git import git_extract_dockerfile
7-
from docker_cli._image import Image
8-
from docker_cli._url_reader import URLReader, get_supported_url_readers, get_url_reader
6+
from wigwam._docker_git import git_extract_dockerfile
7+
from wigwam._image import Image
8+
from wigwam._url_reader import URLReader, get_supported_url_readers, get_url_reader
99

1010
from .utils import generate_tag, rough_dockerfile_validity_check
1111

test/test_docker_insert.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from pytest import mark
22

3-
from docker_cli._docker_insert import insert_dir_dockerfile
4-
from docker_cli._image import Image
3+
from wigwam._docker_insert import insert_dir_dockerfile
4+
from wigwam._image import Image
55

66
from .utils import generate_tag, rough_dockerfile_validity_check
77

test/test_docker_mamba.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
from pytest import fixture, mark
55

6-
from docker_cli import Image
7-
from docker_cli._docker_mamba import mamba_add_reqs_dockerfile, mamba_install_dockerfile
6+
from wigwam import Image
7+
from wigwam._docker_mamba import mamba_add_reqs_dockerfile, mamba_install_dockerfile
88

99
from .utils import (
1010
determine_scope,

test/test_image.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
from pytest import mark, raises
77

8-
from docker_cli import CommandNotFoundError, DockerBuildError, Image
9-
from docker_cli._exceptions import ImageNotFoundError
10-
from docker_cli._image import get_image_id
8+
from wigwam import CommandNotFoundError, DockerBuildError, Image
9+
from wigwam._exceptions import ImageNotFoundError
10+
from wigwam._image import get_image_id
1111

1212
from .utils import remove_docker_image
1313

0 commit comments

Comments
 (0)