Permalink
Browse files

glob() now supports a string additionally to a list of strings

  • Loading branch information...
NiklasRosenstein committed Jan 18, 2017
1 parent 3123900 commit 1f0b9c20b229284b1bb7c4573ef5c7b3a2bc88fa
Showing with 8 additions and 4 deletions.
  1. +1 −0 CHANGES.md
  2. +2 −2 README.md
  3. +4 −1 craftr/utils/path.py
  4. +1 −1 examples/examples.c/Craftrfile
View
@@ -30,6 +30,7 @@ API Changes
- change `runtarget()` to take `Target.runprefix` into account
- change `path.norm()` now makes sure that path is lowercased on Windows
- change `load_file()` now adds the loaded file to `Module.dependent_files`
- change `glob(patterns)` now accepts a string additionally to a list of strings
- rename `load_module()` to `load()`, using the old name displays a warning
Library Changes
View
@@ -25,7 +25,7 @@ __C++ Example__
```python
cxx = load('craftr.lang.cxx')
program = cxx.executable(
inputs = cxx.compile_cpp(sources = glob(['src/**/*.cpp'])),
inputs = cxx.compile_cpp(sources = glob('src/**/*.cpp')),
output = 'main'
)
```
@@ -46,7 +46,7 @@ __C# Example__
```python
cs = load('craftr.lang.csharp')
app = cs.compile(
sources = glob(['src/**/*.cs']),
sources = glob('src/**/*.cs'),
output = 'Main',
target = 'exe'
)
View
@@ -101,10 +101,13 @@ def glob(patterns, parent=None, excludes=(), include_dotfiles=False, ignore_fals
:return: A list of filenames.
"""
argspec.validate('patterns', patterns, {'type': [list, tuple]})
argspec.validate('patterns', patterns, {'type': [list, tuple, str]})
argspec.validate('excludes', excludes, {'type': [list, tuple]})
argspec.validate('parent', parent, {'type': [None, str]})
if isinstance(patterns, str):
patterns = [patterns]
if not parent:
parent = getcwd()
@@ -18,7 +18,7 @@ from os import environ
cxx = load('craftr.lang.cxx')
program = cxx.executable(
inputs = cxx.compile_c(sources = glob(['src/*.c'])),
inputs = cxx.compile_c(sources = glob('src/*.c')),
output = 'main'
)

0 comments on commit 1f0b9c2

Please sign in to comment.