beardsvibe / buildfox

Minimalistic Ninja generator
MIT License
50 stars 8 forks source link

ValueError: please only use forward slashes in path #99

Closed xpac27 closed 8 years ago

xpac27 commented 8 years ago

When using the latest bf from pip (to this date) and modifying my config file line 14:

build out/objects/lib/**_*.obj: cxx lib/src/**/*.cpp

and line 23:

build out/libs/shlib(tw) | out/libs/lib(tw): cxx out/objects/lib/**_*.obj

I get the following error:

$ bf
Traceback (most recent call last):
  File "/usr/local/bin/bf", line 9, in <module>
    load_entry_point('buildfox==0.1.2', 'console_scripts', 'bf')()
  File "/Library/Python/2.7/site-packages/buildfox/__init__.py", line 1775, in main
    engine.load(args.get("in"))
  File "/Library/Python/2.7/site-packages/buildfox/__init__.py", line 820, in load
    parse(self, filename)
  File "/Library/Python/2.7/site-packages/buildfox/__init__.py", line 459, in parse
    parser.parse()
  File "/Library/Python/2.7/site-packages/buildfox/__init__.py", line 73, in parse
    self.parse_line()
  File "/Library/Python/2.7/site-packages/buildfox/__init__.py", line 98, in parse_line
    self.engine.on_build(obj, assigns)
  File "/Library/Python/2.7/site-packages/buildfox/__init__.py", line 1045, in on_build
    inputs_explicit, targets_explicit = self.eval_find_files(obj[3], obj[0])
  File "/Library/Python/2.7/site-packages/buildfox/__init__.py", line 877, in eval_find_files
    excluded_dirs = self.excluded_dirs)
  File "/Library/Python/2.7/site-packages/buildfox/__init__.py", line 638, in find_files
    raise ValueError("please only use forward slashes in path \"%s\"" % input)
ValueError: please only use forward slashes in path "out/objects/lib/**_*.obj"
jimon commented 8 years ago

I'll try to reproduce it :)

jimon commented 8 years ago

I guess problems are this :

xpac27 commented 8 years ago

I tried .o instead of .obj and got the same error. Now I tried what you suggested this way:

build out/objects/lib/obj(**/*): auto lib/src/**/*.cpp

And it works :joy: :+1: I guess what was confusing to me was that the manual says:

# recursive glob
build **/*.obj: cxx **/*.cxx

And I was a bit confused by .obj VS obj().

Also, I haven't looked at the config file for a week and when reading it again I thought out/objects/lib/obj was a folder. Bu that's just me :angel: maybe obj being an extension, a function and sometimes a folder could be misleading.

jimon commented 8 years ago

So to avoid confusion try using obj macro on whole path like this : build obj(out/objects/lib/**/*): auto lib/src/**/*.cpp

jimon commented 8 years ago

Maybe I need to disable ability to use macro inside path :)

den-mentiei commented 8 years ago

@jimon maybe we need a prefix or some kind of special notation for that transformers, like variables have.

den-mentiei commented 8 years ago

Indeed, we should allow only one use case of that transformer!

xpac27 commented 8 years ago

Maybe the obj() macro could have a better name, like object_files() or something else (instead of having the same name as an extension ^^). Same goes for lib() and app(). They could be named library_file() and application_file(). To me this would be easier to read:

build object_files(out/**/*): auto lib/src/**/*.cpp
build library_file(out/lib/mylib): auto object_files(out/**/*)

I guess those abbreviated macro at the end of paths are my main source of confusion.

This is just a suggestion of course :ghost:

den-mentiei commented 8 years ago

I'm thinking about it :) We shouldn't include that "_file" suffix, imo.

We can go with objects, executable, library, shared_library :)

den-mentiei commented 8 years ago

102

jimon commented 8 years ago

Error handling will be improved in #101, so closing this for now