Fix all flake8 warnings in setup.py (#211)
This commit is contained in:
parent
e65a612ac8
commit
357a08b30e
12
setup.py
12
setup.py
@ -9,11 +9,13 @@ import os
|
|||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
def get_version():
|
def get_version():
|
||||||
init_py = open('mopidy/__init__.py').read()
|
init_py = open('mopidy/__init__.py').read()
|
||||||
metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", init_py))
|
metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", init_py))
|
||||||
return metadata['version']
|
return metadata['version']
|
||||||
|
|
||||||
|
|
||||||
class osx_install_data(install_data):
|
class osx_install_data(install_data):
|
||||||
# On MacOS, the platform-specific lib dir is
|
# On MacOS, the platform-specific lib dir is
|
||||||
# /System/Library/Framework/Python/.../ which is wrong. Python 2.5 supplied
|
# /System/Library/Framework/Python/.../ which is wrong. Python 2.5 supplied
|
||||||
@ -28,11 +30,13 @@ class osx_install_data(install_data):
|
|||||||
self.set_undefined_options('install', ('install_lib', 'install_dir'))
|
self.set_undefined_options('install', ('install_lib', 'install_dir'))
|
||||||
install_data.finalize_options(self)
|
install_data.finalize_options(self)
|
||||||
|
|
||||||
|
|
||||||
if sys.platform == "darwin":
|
if sys.platform == "darwin":
|
||||||
cmdclasses = {'install_data': osx_install_data}
|
cmdclasses = {'install_data': osx_install_data}
|
||||||
else:
|
else:
|
||||||
cmdclasses = {'install_data': install_data}
|
cmdclasses = {'install_data': install_data}
|
||||||
|
|
||||||
|
|
||||||
def fullsplit(path, result=None):
|
def fullsplit(path, result=None):
|
||||||
"""
|
"""
|
||||||
Split a pathname into components (the opposite of os.path.join) in a
|
Split a pathname into components (the opposite of os.path.join) in a
|
||||||
@ -47,6 +51,7 @@ def fullsplit(path, result=None):
|
|||||||
return result
|
return result
|
||||||
return fullsplit(head, [tail] + result)
|
return fullsplit(head, [tail] + result)
|
||||||
|
|
||||||
|
|
||||||
# Tell distutils to put the data_files in platform-specific installation
|
# Tell distutils to put the data_files in platform-specific installation
|
||||||
# locations. See here for an explanation:
|
# locations. See here for an explanation:
|
||||||
# http://groups.google.com/group/comp.lang.python/browse_thread/
|
# http://groups.google.com/group/comp.lang.python/browse_thread/
|
||||||
@ -54,6 +59,7 @@ def fullsplit(path, result=None):
|
|||||||
for scheme in INSTALL_SCHEMES.values():
|
for scheme in INSTALL_SCHEMES.values():
|
||||||
scheme['data'] = scheme['purelib']
|
scheme['data'] = scheme['purelib']
|
||||||
|
|
||||||
|
|
||||||
# Compile the list of packages available, because distutils doesn't have
|
# Compile the list of packages available, because distutils doesn't have
|
||||||
# an easy way to do this.
|
# an easy way to do this.
|
||||||
packages, data_files = [], []
|
packages, data_files = [], []
|
||||||
@ -62,6 +68,7 @@ if root_dir != '':
|
|||||||
os.chdir(root_dir)
|
os.chdir(root_dir)
|
||||||
project_dir = 'mopidy'
|
project_dir = 'mopidy'
|
||||||
|
|
||||||
|
|
||||||
for dirpath, dirnames, filenames in os.walk(project_dir):
|
for dirpath, dirnames, filenames in os.walk(project_dir):
|
||||||
# Ignore dirnames that start with '.'
|
# Ignore dirnames that start with '.'
|
||||||
for i, dirname in enumerate(dirnames):
|
for i, dirname in enumerate(dirnames):
|
||||||
@ -70,8 +77,9 @@ for dirpath, dirnames, filenames in os.walk(project_dir):
|
|||||||
if '__init__.py' in filenames:
|
if '__init__.py' in filenames:
|
||||||
packages.append('.'.join(fullsplit(dirpath)))
|
packages.append('.'.join(fullsplit(dirpath)))
|
||||||
elif filenames:
|
elif filenames:
|
||||||
data_files.append([dirpath,
|
data_files.append([
|
||||||
[os.path.join(dirpath, f) for f in filenames]])
|
dirpath, [os.path.join(dirpath, f) for f in filenames]])
|
||||||
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='Mopidy',
|
name='Mopidy',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user