2017-01-09 5 views
1

私は現在、学校 プロジェクトのAdblock Plusのソースコードをビルドしていますが、自動インストールアドオンを使って簡単に ブラウザにデプロイしますPythonで提供されているビルドツールは、何らかの理由でGit Bashでそれらを実行すると、 しか動作しないようです。私は Windowsのコマンドラインでコマンドを実行しようとすると、ここでPythonスクリプトはWindowsコマンドラインでWindowsErrorを投げ、Git Bashで動作します

はエラーメッセージです:

C:\Users\Evert\Documents\GitHub\adblockplus>python build.py autoinstall 8888 
Traceback (most recent call last): 
    File "C:\Users\Evert\Documents\GitHub\adblockplus\ensure_dependencies.py", line 380, in <module> 
    resolve_deps(repo) 
    File "C:\Users\Evert\Documents\GitHub\adblockplus\ensure_dependencies.py", line 324, in resolve_deps 
    update_repo(target, vcs, rev) 
    File "C:\Users\Evert\Documents\GitHub\adblockplus\ensure_dependencies.py", line 272, in update_repo 
    resolved_revision = repo_types[type].get_revision_id(target, revision) 
    File "C:\Users\Evert\Documents\GitHub\adblockplus\ensure_dependencies.py", line 106, in get_revision_id 
    return subprocess.check_output(command, cwd=repo).strip() 
    File "C:\Python27\lib\subprocess.py", line 212, in check_output 
    process = Popen(stdout=PIPE, *popenargs, **kwargs) 
    File "C:\Python27\lib\subprocess.py", line 390, in __init__ 
    errread, errwrite) 
    File "C:\Python27\lib\subprocess.py", line 640, in _execute_child 
    startupinfo) 
WindowsError: [Error 2] The system cannot find the file specified 
Command '['C:\\Python27\\python.exe', 'C:\\Users\\Evert\\Documents\\GitHub\\adblockplus\\ensure_dependencies.py', 'C:\\Users\\Evert\\Documents\\GitHub\\adblockplus']' returned non-zero exit status 1 
Failed to ensure dependencies being up-to-date! 
Traceback (most recent call last): 
    File "build.py", line 18, in <module> 
    buildtools.build.processArgs(BASE_DIR, sys.argv) 
    File "C:\Users\Evert\Documents\GitHub\adblockplus\buildtools\build.py", line 601, in processArgs 
    commands[command](baseDir, scriptName, opts, args, type) 
    File "C:\Users\Evert\Documents\GitHub\adblockplus\buildtools\build.py", line 55, in __call__ 
    return self._handler(baseDir, scriptName, opts, args, type) 
    File "C:\Users\Evert\Documents\GitHub\adblockplus\buildtools\build.py", line 225, in runAutoInstall 
    packager.autoInstall(baseDir, type, host, port, multicompartment=multicompartment) 
    File "C:\Users\Evert\Documents\GitHub\adblockplus\buildtools\packagerGecko.py", line 334, in autoInstall 
    createBuild(baseDir, type=type, outFile=fileBuffer, multicompartment=multicompartment) 
    File "C:\Users\Evert\Documents\GitHub\adblockplus\buildtools\packagerGecko.py", line 294, in createBuild 
    version = getBuildVersion(baseDir, metadata, releaseBuild, buildNum) 
    File "C:\Users\Evert\Documents\GitHub\adblockplus\buildtools\packager.py", line 58, in getBuildVersion 
    buildNum = getBuildNum(baseDir) 
    File "C:\Users\Evert\Documents\GitHub\adblockplus\buildtools\packager.py", line 46, in getBuildNum 
    result = subprocess.check_output(['git', 'rev-list', 'HEAD'], cwd=baseDir) 
    File "C:\Python27\lib\subprocess.py", line 212, in check_output 
    process = Popen(stdout=PIPE, *popenargs, **kwargs) 
    File "C:\Python27\lib\subprocess.py", line 390, in __init__ 
    errread, errwrite) 
    File "C:\Python27\lib\subprocess.py", line 640, in _execute_child 
    startupinfo) 
WindowsError: [Error 2] The system cannot find the file specified 

それが構築んので、これは私にとって大きな問題ではありませんが、私は助けることができません wonder:これら2つの環境の違いは何ですか? このスクリプトは動作しますか?

+0

私の最初の推測は、何かを試している(サブプロセスのモジュールはヒントです)、そのパスのウィンドウの下では利用できないということです。例/c/windows/notepad.exeとc:\ windows \ notepad.exe。 – RedX

+1

問題はおそらく "subprocess.check_output(['git'、 'rev-list'、 'HEAD']、cwd = baseDir)"です - gitがシステムのパスなどにあるかどうかを確認してください。窓は私にとっては黒い魔法です。 – MacHala

+0

ところで、サイトにようこそ!何を期待するかについては、[ツアー](https://stackoverflow.com/tour)をご覧ください。 – cxw

答えて

0

問題は、git.exeがご使用のWindowsにはありませんPATH、これは間違いなくGit Bashにあります:)。 ensure_dependencies.py

  1. 、ライン106、commandを実行する:あなたは、両方のgitための2つの "見つかりません" というエラーを持っています。 the sourceで、コマンドは['git', 'rev-parse', '--revs-only', rev + '^{commit}']です。
  2. packager.pyの行46、['git', 'rev-list', 'HEAD']を実行中。

これらはいずれも、gitです。 python build.pyを実行する前に、修正するには、

path %PATH%;c:\<wherever git.exe is located> 

をするか、またはコントロールパネルを使用して、システムのPATHにgit.exeの場所を追加。

編集あなたのGitのインストールはGitHubのからのものである場合、this answerはあなたのPATHにGitリポジトリの追加の詳細を提供します。

+0

ありがとう、私のパスにgit.exeを追加するのが解決策でした。 –

関連する問題