0

問題:

2 つのソース ディレクトリがあり、1 つは「現在の」ディレクトリにあり、もう 1 つは他のディレクトリにあります」

1: C:/somedir/dir_a/[win32、win64]/[テスト、ドキュメント、a、b]

そして
2: D:/projects/project_a/api/[win32, win64]/[tests, a, b, c]

sconstruct @ D:/projects/project_a/sconstruct

ここで、ルート「win32」を使用して、両方のディレクトリをzipファイルに入れたいと思います。ディレクトリ 2 (D:/..) には win32 フォルダー + コンテンツが既に sconstruct にコピーされています。これは、scons に関する限り、D:/projects/project_a/api/win32 (または win64) が既にターゲットであることを意味します (afaik)。 .

私が試したこと:

次に、ディレクトリ 1 (c:/..) をディレクトリ 2 にコピーしようとすると、ターゲットが既に存在するため、コピーできません。それはすでに最初の試みです。

2 回目の試行では、env.Zip を使用して 2 つのディレクトリを Zip で取得しました。これは機能しましたが、完全に間違ったルートになっています。zip は次のようになりました。

zip..somedir/dir_a/win32/[tests, documentation, a, b]
   |.api/win32/[tests, a, b, c]

私が欲しかったところ:

zip..win32/[tests, documentation, a, b, c]

Sconsでこれを適切に行う方法はありますか?

4

1 に答える 1

1

Found Solution:

Hi All,

found a proper solution for the root-less copytree problem I had.

Using the Accumulator found @ http://www.scons.org/wiki/AccumulateBuilder

Then just calling it as:

target = "dir where you want to copy contents of source"
basedir = "source dir containing content to be copied"
env.Accumulate(target, [os.path.join(basedir ,x) for x in os.listdir(basedir)])

Hope this helps someone else in the future with a similar problem :)

于 2013-02-27T23:07:16.640 に答える