lib/autobuild/subcommand.rb in autobuild-1.7.10 vs lib/autobuild/subcommand.rb in autobuild-1.7.11.rc1

- old
+ new

@@ -69,15 +69,10 @@ def self.autodetect_processor_count if @processor_count return @processor_count end - #No parralel build on windows yet, since CPU detection is not easy do able - if(RbConfig::CONFIG["host_os"] =~%r!(msdos|mswin|djgpp|mingw|[Ww]indows)!) - return 1 - end - if File.file?('/proc/cpuinfo') cpuinfo = File.readlines('/proc/cpuinfo') physical_ids, core_count, processor_ids = [], [], [] cpuinfo.each do |line| case line @@ -96,11 +91,11 @@ if (physical_ids.size == core_count.size) && (physical_ids.size == processor_ids.size) info = Array.new while (id = physical_ids.shift) info[id] = core_count.shift end - @processor_count = info.inject(&:+) + @processor_count = info.compact.inject(&:+) else @processor_count = processor_ids.size end else result = Open3.popen3("sysctl", "-n", "hw.ncpu") do |_, io, _| @@ -114,9 +109,14 @@ # The format of the cpuinfo file is ... let's say not very standardized. # If the cpuinfo detection fails, inform the user and set it to 1 if !@processor_count # Hug... What kind of system is it ? Autobuild.message "INFO: cannot autodetect the number of CPUs on this sytem" + Autobuild.message "INFO: turning parallel builds off" + Autobuild.message "INFO: you can manually set the number of parallel build processes to N" + Autobuild.message "INFO: (and therefore turn this message off)" + Autobuild.message "INFO: with" + Autobuild.message " Autobuild.parallel_build_level = N" @processor_count = 1 end @processor_count end