Valentin David pushed to branch valentindavid/fix-recursive-strip-debug at BuildStream / buildstream
Commits:
-
516e990e
by ctolentino8 at 2018-10-31T11:36:46Z
-
b8a37a63
by Tristan Van Berkom at 2018-11-01T10:16:25Z
-
b27b592a
by Benjamin Schubert at 2018-11-01T10:49:57Z
-
89ace5d7
by Benjamin Schubert at 2018-11-01T11:16:36Z
-
491efe99
by Valentin David at 2018-11-01T11:37:53Z
4 changed files:
Changes:
... | ... | @@ -305,7 +305,6 @@ class App(): |
305 | 305 |
directory = self._main_options['directory']
|
306 | 306 |
directory = os.path.abspath(directory)
|
307 | 307 |
project_path = os.path.join(directory, 'project.conf')
|
308 |
- elements_path = os.path.join(directory, element_path)
|
|
309 | 308 |
|
310 | 309 |
try:
|
311 | 310 |
# Abort if the project.conf already exists, unless `--force` was specified in `bst init`
|
... | ... | @@ -335,6 +334,7 @@ class App(): |
335 | 334 |
raise AppError("Error creating project directory {}: {}".format(directory, e)) from e
|
336 | 335 |
|
337 | 336 |
# Create the elements sub-directory if it doesnt exist
|
337 |
+ elements_path = os.path.join(directory, element_path)
|
|
338 | 338 |
try:
|
339 | 339 |
os.makedirs(elements_path, exist_ok=True)
|
340 | 340 |
except IOError as e:
|
... | ... | @@ -62,6 +62,11 @@ variables: |
62 | 62 |
-o -name '*.cmxs' -o -name '*.node' ')' \
|
63 | 63 |
-exec sh -ec \
|
64 | 64 |
'read -n4 hdr <"$1" # check for elf header
|
65 |
+ case "$1" in
|
|
66 |
+ %{install-root}%{debugdir}/*)
|
|
67 |
+ exit 0
|
|
68 |
+ ;;
|
|
69 |
+ esac
|
|
65 | 70 |
if [ "$hdr" != "$(printf \\x7fELF)" ]; then
|
66 | 71 |
exit 0
|
67 | 72 |
fi
|
... | ... | @@ -39,6 +39,7 @@ if sys.version_info[0] != REQUIRED_PYTHON_MAJOR or sys.version_info[1] < REQUIRE |
39 | 39 |
try:
|
40 | 40 |
from setuptools import setup, find_packages, Command
|
41 | 41 |
from setuptools.command.easy_install import ScriptWriter
|
42 |
+ from setuptools.command.test import test as TestCommand
|
|
42 | 43 |
except ImportError:
|
43 | 44 |
print("BuildStream requires setuptools in order to build. Install it using"
|
44 | 45 |
" your package manager (usually python3-setuptools) or via pip (pip3"
|
... | ... | @@ -219,9 +220,48 @@ class BuildGRPC(Command): |
219 | 220 |
f.write(code)
|
220 | 221 |
|
221 | 222 |
|
223 |
+#####################################################
|
|
224 |
+# Pytest command #
|
|
225 |
+#####################################################
|
|
226 |
+class PyTest(TestCommand):
|
|
227 |
+ """Defines a pytest command class to run tests from setup.py"""
|
|
228 |
+ |
|
229 |
+ user_options = TestCommand.user_options + [
|
|
230 |
+ ("addopts=", None, "Arguments to pass to pytest"),
|
|
231 |
+ ('index-url=''build_grpc': BuildGRPC,
|
|
264 |
+ 'pytest': PyTest,
|
|
225 | 265 |
}
|
226 | 266 |
cmdclass.update(versioneer.get_cmdclass())
|
227 | 267 |
return cmdclass
|
... | ... | @@ -305,6 +345,5 @@ setup(name='BuildStream', |
305 | 345 |
'grpcio >= 1.10',
|
306 | 346 |
],
|
307 | 347 |
entry_points=bst_install_entry_points,
|
308 |
- setup_requires=['pytest-runner'],
|
|
309 | 348 |
tests_require=dev_requires,
|
310 | 349 |
zip_safe=False)
|
... | ... | @@ -3,6 +3,7 @@ import pytest |
3 | 3 |
from tests.testutils import cli
|
4 | 4 |
|
5 | 5 |
from buildstream import _yaml
|
6 |
+from buildstream._frontend.app import App
|
|
6 | 7 |
from buildstream._exceptions import ErrorDomain, LoadErrorReason
|
7 | 8 |
from buildstream._versions import BST_FORMAT_VERSION
|
8 | 9 |
|
... | ... | @@ -98,3 +99,34 @@ def test_bad_element_path(cli, tmpdir, element_path): |
98 | 99 |
'init', '--project-name', 'foo', '--element-path', element_path
|
99 | 100 |
])
|
100 | 101 |
result.assert_main_error(ErrorDomain.APP, 'invalid-element-path')
|
102 |
+ |
|
103 |
+ |
|
104 |
+@pytest.mark.parametrize("element_path", [('foo'), ('foo/bar')])
|
|
105 |
+def test_element_path_interactive(cli, tmp_path, monkeypatch, element_path):
|
|
106 |
+ project = tmp_path
|
|
107 |
+ project_conf_path = project.joinpath('project.conf')
|
|
108 |
+ |
|
109 |
+ class DummyInteractiveApp(App):
|
|
110 |
+ def __init__(self, *args, **kwargs):
|
|
111 |
+ super().__init__(*args, **kwargs)
|
|
112 |
+ self.interactive = True
|
|
113 |
+ |
|
114 |
+ @classmethod
|
|
115 |
+ def create(cls, *args, **kwargs):
|
|
116 |
+ return DummyInteractiveApp(*args, **kwargs)
|
|
117 |
+ |
|
118 |
+ def _init_project_interactive(self, *args, **kwargs):
|
|
119 |
+ return ('project_name', '0', element_path)
|
|
120 |
+ |
|
121 |
+ monkeypatch.setattr(App, 'create', DummyInteractiveApp.create)
|
|
122 |
+ |
|
123 |
+ result = cli.run(project=str(project), args=['init'])
|
|
124 |
+ result.assert_success()
|
|
125 |
+ |
|
126 |
+ full_element_path = project.joinpath(element_path)
|
|
127 |
+ assert full_element_path.exists()
|
|
128 |
+ |
|
129 |
+ project_conf = _yaml.load(str(project_conf_path))
|
|
130 |
+ assert project_conf['name'] == 'project_name'
|
|
131 |
+ assert project_conf['format-version'] == '0'
|
|
132 |
+ assert project_conf['element-path'] == element_path
|