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 sys
|
||||
|
||||
|
||||
def get_version():
|
||||
init_py = open('mopidy/__init__.py').read()
|
||||
metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", init_py))
|
||||
return metadata['version']
|
||||
|
||||
|
||||
class osx_install_data(install_data):
|
||||
# On MacOS, the platform-specific lib dir is
|
||||
# /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'))
|
||||
install_data.finalize_options(self)
|
||||
|
||||
|
||||
if sys.platform == "darwin":
|
||||
cmdclasses = {'install_data': osx_install_data}
|
||||
else:
|
||||
cmdclasses = {'install_data': install_data}
|
||||
|
||||
|
||||
def fullsplit(path, result=None):
|
||||
"""
|
||||
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 fullsplit(head, [tail] + result)
|
||||
|
||||
|
||||
# Tell distutils to put the data_files in platform-specific installation
|
||||
# locations. See here for an explanation:
|
||||
# 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():
|
||||
scheme['data'] = scheme['purelib']
|
||||
|
||||
|
||||
# Compile the list of packages available, because distutils doesn't have
|
||||
# an easy way to do this.
|
||||
packages, data_files = [], []
|
||||
@ -62,6 +68,7 @@ if root_dir != '':
|
||||
os.chdir(root_dir)
|
||||
project_dir = 'mopidy'
|
||||
|
||||
|
||||
for dirpath, dirnames, filenames in os.walk(project_dir):
|
||||
# Ignore dirnames that start with '.'
|
||||
for i, dirname in enumerate(dirnames):
|
||||
@ -70,8 +77,9 @@ for dirpath, dirnames, filenames in os.walk(project_dir):
|
||||
if '__init__.py' in filenames:
|
||||
packages.append('.'.join(fullsplit(dirpath)))
|
||||
elif filenames:
|
||||
data_files.append([dirpath,
|
||||
[os.path.join(dirpath, f) for f in filenames]])
|
||||
data_files.append([
|
||||
dirpath, [os.path.join(dirpath, f) for f in filenames]])
|
||||
|
||||
|
||||
setup(
|
||||
name='Mopidy',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user