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
  • 5,516
  • 10
  • 62
  • 136

1 Answers1

0

Pass it in using str.format:

n = multiprocessing.cpu_count()
subprocess.call(["mingw32-make", "-j{}".format(n)], env=environ) 
Padraic Cunningham
  • 176,452
  • 29
  • 245
  • 321