1

I'm currently building the source code for Adblock Plus for a school project and I'm using the Autoinstall addon to easily deploy to my browser, however the provided build tools in Python only seem to work when I execute them in the Git Bash for some reason.

Here is the error message when I try to execute the command in the Windows command line:

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

This isn't a huge problem for me since it does build, but I can't help but wonder: what is the difference between these two environments that makes this script work?

cxw
  • 16,685
  • 2
  • 45
  • 81
  • My first guess is that it is trying t oexecute something (the subprocess modulve is a hint) and that is not available under windows in that path. Example /c/windows/notepad.exe vs c:\windows\notepad.exe. – RedX Jan 09 '17 at 10:30
  • 1
    the problem is probably in "subprocess.check_output(['git', 'rev-list', 'HEAD'], cwd=baseDir)" - check if git is in system path etc. I'd help you more, but windows is black magic to me. – MacHala Jan 09 '17 at 10:55
  • By the way, welcome to the site! Check out the [tour](https://stackoverflow.com/tour) for more about what to expect. – cxw Jan 09 '17 at 13:23

1 Answers1

0

The issue appears to be that git.exe isn't in your Windows PATH, which it definitely is in Git Bash :) . You have two "not found" errors, both for git:

  1. In ensure_dependencies.py, line 106, executing command. Per the source, the command is ['git', 'rev-parse', '--revs-only', rev + '^{commit}'].
  2. In packager.py, line 46, executing ['git', 'rev-list', 'HEAD'].

Both of those are a missing git. To fix, before running python build.py, do

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

or add the location of git.exe to your system PATH using the Control Panel.

Edit If your Git installation is from GitHub, this answer gives details about adding Git to your PATH.

Community
  • 1
  • 1
cxw
  • 16,685
  • 2
  • 45
  • 81