0

I'm using Python in the build of a Qt application. The Python script gets called in different PCs and these PCs might have different number of CPUs. To take advantage of that, in the make step I 'm specifying the number of CPUs:

subprocess.call(["mingw32-make",
                 "-j4"], shell=True, env=environ)

To check the number of CPUs I do:

n = multiprocessing.cpu_count()

How do I replace the -j4 by n?

KcFnMi
  • 4,665
  • 8
  • 52
  • 106

1 Answers1

0

Pass it in using str.format:

n = multiprocessing.cpu_count()
subprocess.call(["mingw32-make", "-j{}".format(n)], env=environ) 
Padraic Cunningham
  • 168,988
  • 22
  • 228
  • 312