Skip to content

Commit

Permalink
Use multiprocess if available
Browse files Browse the repository at this point in the history
On Windows, we force it to be installed as most users will need it.
  • Loading branch information
tbekolay committed Aug 4, 2020
1 parent 6bb833d commit 67c5c4e
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 6 deletions.
3 changes: 1 addition & 2 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

=======
Changes
=======
Expand All @@ -8,6 +7,7 @@ Changes

- python 3.8 support
- BACKWARD INCOMPATIBLE: Drop Python 3.4 support
- support `multiprocess` and require it for Windows


0.32.0 (*2019-12-10*)
Expand Down Expand Up @@ -527,4 +527,3 @@ Changes
====================

- initial release

2 changes: 2 additions & 0 deletions doc/cmd_run.rst
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ parallel execution
This allows different tasks to be run in parallel, as long any dependencies are met.
By default the `multiprocessing <http://docs.python.org/library/multiprocessing.html>`_
module is used.
If the `multiprocess <https://pypi.org/project/multiprocess/>`_ module is installed,
it will be used instead.
So the same restrictions also apply to the use of multiprocessing in `doit`.

.. code-block:: console
Expand Down
5 changes: 4 additions & 1 deletion doit/cmd_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
import os
import time
import sys
from multiprocessing import Process
try:
from multiprocess import Process
except ImportError:
from multiprocessing import Process
from subprocess import call

from .exceptions import InvalidCommand
Expand Down
5 changes: 4 additions & 1 deletion doit/runner.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
"""Task runner"""

from multiprocessing import Process, Queue as MQueue
try:
from multiprocess import Process, Queue as MQueue
except ImportError:
from multiprocessing import Process, Queue as MQueue
from threading import Thread
import pickle
import queue
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
extras_require={
':sys.platform == "darwin"': ['macfsevents'],
':sys.platform == "linux"': ['pyinotify'],
':sys.platform == "win32"': ['multiprocess'],
},
long_description = long_description,
entry_points = {
Expand Down
5 changes: 4 additions & 1 deletion tests/test_cmd_auto.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import time
from multiprocessing import Process
try:
from multiprocess import Process
except ImportError:
from multiprocessing import Process

import pytest

Expand Down
5 changes: 4 additions & 1 deletion tests/test_runner.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import os
import pickle
from multiprocessing import Queue
try:
from multiprocess import Queue
except ImportError:
from multiprocessing import Queue
import platform
from unittest.mock import Mock

Expand Down

0 comments on commit 67c5c4e

Please sign in to comment.