@@ -66,32 +66,33 @@ def get_setup_result(setup_py, env=None):
6666 :param env: environment variables to set before running setup.py
6767 :return: Dictionary of data describing the package.
6868 """
69- with multiprocessing .Manager () as manager :
70- d = manager .dict ()
71- p = multiprocessing .Process (
72- target = _get_setup_result_target ,
73- args = (setup_py , env , d )
74- )
75- p .start ()
76- p .join ()
77- if p .exitcode :
78- logger .warn ("setup script %s terminated with exit code %d" ,
79- setup_py , p .exitcode )
80-
81- # turn the DictProxy into a dict
82- return dict (d )
83-
84-
85- def _get_setup_result_target (setup_py , env , out_dict ):
69+
70+ conn_recv , conn_send = multiprocessing .Pipe (duplex = False )
71+ p = multiprocessing .Process (
72+ target = _get_setup_result_target ,
73+ args = (setup_py , env , conn_send )
74+ )
75+ p .start ()
76+ p .join ()
77+ if p .exitcode :
78+ logger .warn ("Python setup script '%s' terminated with exit code %d" ,
79+ setup_py , p .exitcode )
80+
81+ if not conn_recv .poll ():
82+ return None
83+ return conn_recv .recv ()
84+
85+
86+ def _get_setup_result_target (setup_py , env , conn_send ):
8687 """
8788 Run setup.py in a modified environment.
8889
8990 Helper function for get_setup_metadata.
9091
9192 :param setup_py: path to a setup.py script
9293 :param env: environment variables to set before running setup.py
93- :param out_dict: dict to populate with the results of setup.py
94- :return: None
94+ :param conn_send: Connection to send the results dictionary
95+ :return: None. Results are transmitted via conn_send.
9596 """
9697 import os
9798 import distutils .core
@@ -108,8 +109,8 @@ def _get_setup_result_target(setup_py, env, out_dict):
108109
109110 # could just return all attrs in result.__dict__, but we take this
110111 # opportunity to filter a few things that don't need to be there
111- out_dict . update ([
112- ( attr , value ) for attr , value in result .__dict__ .items ()
112+ conn_send . send ({
113+ attr : value for attr , value in result .__dict__ .items ()
113114 if (
114115 # These *seem* useful but always have the value 0.
115116 # Look for their values in the 'metadata' object instead.
@@ -118,7 +119,7 @@ def _get_setup_result_target(setup_py, env, out_dict):
118119 and not callable (value )
119120 # Private properties
120121 and not attr .startswith ('_' )
121- )] )
122+ )} )
122123
123124
124125def create_dependency_descriptor (requirement_string ):
0 commit comments