Skip to content

Commit 1942bca

Browse files
authored
Merge pull request #23 from uilianries/hotfix/conanfile-path
Accept custom Conanfile path by env var
2 parents efc636d + 5f688f4 commit 1942bca

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

Diff for: bincrafters/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# -*- coding: utf-8 -*-
22

3-
__version__ = '0.18.0'
3+
__version__ = '0.18.1'

Diff for: bincrafters/build_shared.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010

1111

1212
def get_recipe_path(cwd=None):
13+
conanfile = os.getenv("CONAN_CONANFILE", "conanfile.py")
1314
if cwd is None:
14-
return "conanfile.py"
15+
return conanfile
1516
else:
16-
return os.path.join(cwd, "conanfile.py")
17+
return os.path.join(cwd, conanfile)
1718

1819

1920
def get_bool_from_env(var_name, default="1"):

Diff for: tests/test_unit_tests.py

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# -*- coding: utf-8 -*-
2+
3+
import os
4+
import pytest
5+
6+
from bincrafters.build_shared import get_recipe_path
7+
8+
9+
@pytest.fixture()
10+
def set_conanfile_path():
11+
os.environ["CONAN_CONANFILE"] = "foobar.py"
12+
yield
13+
del os.environ["CONAN_CONANFILE"]
14+
15+
16+
def test_get_recipe_path_default():
17+
assert "conanfile.py" == get_recipe_path()
18+
19+
20+
def test_get_recipe_path_conanfile(set_conanfile_path):
21+
assert "foobar.py" == get_recipe_path()
22+
23+
24+
def test_get_recipe_path_custom():
25+
assert os.path.join("tmp", "conanfile.py") == get_recipe_path(cwd="tmp")

0 commit comments

Comments
 (0)