cons-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Chmod issues


From: Steven Knight
Subject: Re: Chmod issues
Date: Mon, 30 Oct 2000 14:22:38 -0600 (CST)

On Mon, 30 Oct 2000, Zachary Deretsky wrote:
> PROBLEM 1.
> 
> rings.i, input for swig has the line '%module ringspyapi' which tells swig
> to generate
> ringspyapi.py in the directory from which swig is run.
> 
> Cons runs swig from the #/ directory therefore it produces file
> #/ringspyapy.py and NOT
> $BUILD/ringspyapi/src/ringspyapi.py
> 
> I think, I have two options:
> 1. Do some kind of chmod  before swig. How to do it and to what dir?
> 2. Somehow through linking generate $BUILD/ringspyapi.py ( I do not want to
> pollute the source tree #/ )
> and then move it down to $BUILD/ringspyapi/src/ringspyapi.py.

I assume you mean "chdir", not "chmod."

This situation has come up for some people using tools that always assume
they'll write their output files in the current directory.

If the tool (swig in this case) has some sort of option to put its
output in some other directory, you can change the command line to add
that option.

If not, people have worked around this by running it as normal and then
copying the output file from the top-level directory to the Conscript
file's directory:

        $conscript_dir = DirPath '.';

        Command ... qq(
                tool
                cp %>:f $conscript_dir:%>:f
        );

> PROBLEM 2
> 
> I perceive an inconsistency in how Command method works:
> target and source files are relative to the build directory
> ($BUILD/ringspyapi/src)
> while the files in the command lines are relative to the top of the source
> tree ( #/ )

The issue is that Cons can't know which of your command-line arguments
are file names that would need to have a directory name appended to
the beginning.  This is why you should use %> and %<, not hard-code the
file names, because %> and %< are constructed with path names that refer
to the actual directories in which the files live.

> My problems are relevant to the lingering discussion of cons chmodding to
> the build directory,
> it seems, this would resolve some of my issues.

Cons 2.1.2 solves this by letting you specify

        Conscript_chdir 1;

In which case it will chdir to the directory of each Conscript file
when it executes the Command(s).  It sounds like this would make your
life a lot easier, so I'd suggest giving 2.1.2 a try.

Don't be too nervous about the "development" label on it.  It passes
the same set of regression tests that 2.0.2 does (and then some).

> PROBLEM 3
> 
> For the last command line, it seems cons cannot find fliter.pl which lives
> in #/ringspyapi/src/ directory
> What is the right way to specify this given that I manage to generate
> ringspyapi.py in $BUILD/ringspyapi/src?
> This problem might go away once I resolve PROBLEM 1, so I will come back to
> this question if it persists.


If you don't solve this some other way, the best bet is to use DirPath
(example above) to generate the right path name relative to the top-level
directory as appropriate.

        --SK




reply via email to

[Prev in Thread] Current Thread [Next in Thread]