avoid shadowing __name__

This commit is contained in:
Henning Peters 2016-02-15 01:33:39 +01:00
parent 4c9e3c7911
commit 9cc4f8d5b3
4 changed files with 7 additions and 7 deletions

View File

@ -162,7 +162,7 @@ def setup_package():
generate_cython(root, 'spacy') generate_cython(root, 'spacy')
setup( setup(
name=about['__name__'], name=about['__title__'],
zip_safe=False, zip_safe=False,
packages=PACKAGES, packages=PACKAGES,
package_data={'': ['*.pyx', '*.pxd', '*.txt', '*.tokens']}, package_data={'': ['*.pyx', '*.pxd', '*.txt', '*.tokens']},

View File

@ -3,7 +3,7 @@
# https://python-packaging-user-guide.readthedocs.org/en/latest/single_source_version/ # https://python-packaging-user-guide.readthedocs.org/en/latest/single_source_version/
# https://github.com/pypa/warehouse/blob/master/warehouse/__about__.py # https://github.com/pypa/warehouse/blob/master/warehouse/__about__.py
__name__ = 'spacy' __title__ = 'spacy'
__version__ = '0.100.5' __version__ = '0.100.5'
__summary__ = 'Industrial-strength NLP' __summary__ = 'Industrial-strength NLP'
__uri__ = 'https://spacy.io' __uri__ = 'https://spacy.io'

View File

@ -29,20 +29,20 @@ def migrate(path):
) )
def main(data_size='all', force=False): def main(data_size='all', force=False):
if force: if force:
sputnik.purge(about.__name__, about.__version__) sputnik.purge(about.__title__, about.__version__)
try: try:
sputnik.package(about.__name__, about.__version__, about.__default_model__) sputnik.package(about.__title__, about.__version__, about.__default_model__)
print("Model already installed. Please run 'python -m " print("Model already installed. Please run 'python -m "
"spacy.en.download --force' to reinstall.", file=sys.stderr) "spacy.en.download --force' to reinstall.", file=sys.stderr)
sys.exit(1) sys.exit(1)
except (PackageNotFoundException, CompatiblePackageNotFoundException): except (PackageNotFoundException, CompatiblePackageNotFoundException):
pass pass
package = sputnik.install(about.__name__, about.__version__, about.__default_model__) package = sputnik.install(about.__title__, about.__version__, about.__default_model__)
try: try:
sputnik.package(about.__name__, about.__version__, about.__default_model__) sputnik.package(about.__title__, about.__version__, about.__default_model__)
except (PackageNotFoundException, CompatiblePackageNotFoundException): except (PackageNotFoundException, CompatiblePackageNotFoundException):
print("Model failed to install. Please run 'python -m " print("Model failed to install. Please run 'python -m "
"spacy.en.download --force'.", file=sys.stderr) "spacy.en.download --force'.", file=sys.stderr)

View File

@ -22,7 +22,7 @@ def get_package(data_dir):
def get_package_by_name(name=None, via=None): def get_package_by_name(name=None, via=None):
try: try:
return sputnik.package(about.__name__, about.__version__, return sputnik.package(about.__title__, about.__version__,
name or about.__default_model__, data_path=via) name or about.__default_model__, data_path=via)
except PackageNotFoundException as e: except PackageNotFoundException as e:
raise RuntimeError("Model not installed. Please run 'python -m " raise RuntimeError("Model not installed. Please run 'python -m "