mirror of
				https://github.com/explosion/spaCy.git
				synced 2025-11-04 09:57:26 +03:00 
			
		
		
		
	Use pkg_resources instead of pip for is_package (resolves #1293)
This commit is contained in:
		
							parent
							
								
									ebf8942564
								
							
						
					
					
						commit
						68f66aebf8
					
				| 
						 | 
					@ -13,7 +13,6 @@ requests>=2.13.0,<3.0.0
 | 
				
			||||||
regex==2017.4.5
 | 
					regex==2017.4.5
 | 
				
			||||||
ftfy>=4.4.2,<5.0.0
 | 
					ftfy>=4.4.2,<5.0.0
 | 
				
			||||||
pytest>=3.0.6,<4.0.0
 | 
					pytest>=3.0.6,<4.0.0
 | 
				
			||||||
pip>=9.0.0,<10.0.0
 | 
					 | 
				
			||||||
mock>=2.0.0,<3.0.0
 | 
					mock>=2.0.0,<3.0.0
 | 
				
			||||||
msgpack-python
 | 
					msgpack-python
 | 
				
			||||||
msgpack-numpy
 | 
					msgpack-numpy
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										1
									
								
								setup.py
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								setup.py
									
									
									
									
									
								
							| 
						 | 
					@ -197,7 +197,6 @@ def setup_package():
 | 
				
			||||||
                'preshed>=1.0.0,<2.0.0',
 | 
					                'preshed>=1.0.0,<2.0.0',
 | 
				
			||||||
                'thinc>=6.8.1,<6.9.0',
 | 
					                'thinc>=6.8.1,<6.9.0',
 | 
				
			||||||
                'plac<1.0.0,>=0.9.6',
 | 
					                'plac<1.0.0,>=0.9.6',
 | 
				
			||||||
                'pip>=9.0.0,<10.0.0',
 | 
					 | 
				
			||||||
                'six',
 | 
					                'six',
 | 
				
			||||||
                'pathlib',
 | 
					                'pathlib',
 | 
				
			||||||
                'ujson>=1.35',
 | 
					                'ujson>=1.35',
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,7 +3,7 @@ from __future__ import unicode_literals, print_function
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import os
 | 
					import os
 | 
				
			||||||
import ujson
 | 
					import ujson
 | 
				
			||||||
import pip
 | 
					import pkg_resources
 | 
				
			||||||
import importlib
 | 
					import importlib
 | 
				
			||||||
import regex as re
 | 
					import regex as re
 | 
				
			||||||
from pathlib import Path
 | 
					from pathlib import Path
 | 
				
			||||||
| 
						 | 
					@ -180,9 +180,9 @@ def is_package(name):
 | 
				
			||||||
    name (unicode): Name of package.
 | 
					    name (unicode): Name of package.
 | 
				
			||||||
    RETURNS (bool): True if installed package, False if not.
 | 
					    RETURNS (bool): True if installed package, False if not.
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    packages = pip.get_installed_distributions()
 | 
					    packages = pkg_resources.working_set.by_key.keys()
 | 
				
			||||||
    for package in packages:
 | 
					    for package in packages:
 | 
				
			||||||
        if package.project_name.replace('-', '_') == name:
 | 
					        if package.replace('-', '_') == name:
 | 
				
			||||||
            return True
 | 
					            return True
 | 
				
			||||||
    return False
 | 
					    return False
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user