Reputation: 323
As part of my build, I need to create a directory. With waf, I can, for example, create symlinks with Build.BuildContext.symlink_as
. But I can not find something like mkdir
. What is the best way to create an empty directory (ideally at install time).
Upvotes: 2
Views: 1001
Reputation: 15180
You have a mkdir()
method in the Node
object. So you can do something like:
def build(bld):
# create foo directory in the build directory
bld.path.get_bld().make_node("foo").mkdir()
WAF usually create directories whenever needed.
If you want to create a directory outside of the build tree, when installing, you can use bare python, like:
import os
def build(bld):
if bld.cmd == "install":
d = os.path.join(bld.options.destdir, "what/ever/you/want")
if not os.path.exists(d):
os.makedirs(d)
Note that bld.options.destdir
can be modified by the --destdir
option :)
Upvotes: 1