Home | History | Annotate | Download | only in devlib
      1 #    Copyright 2013-2015 ARM Limited
      2 #
      3 # Licensed under the Apache License, Version 2.0 (the "License");
      4 # you may not use this file except in compliance with the License.
      5 # You may obtain a copy of the License at
      6 #
      7 #     http://www.apache.org/licenses/LICENSE-2.0
      8 #
      9 # Unless required by applicable law or agreed to in writing, software
     10 # distributed under the License is distributed on an "AS IS" BASIS,
     11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     12 # See the License for the specific language governing permissions and
     13 # limitations under the License.
     14 #
     15 
     16 import os
     17 import sys
     18 import warnings
     19 from itertools import chain
     20 
     21 try:
     22     from setuptools import setup
     23 except ImportError:
     24     from distutils.core import setup
     25 
     26 
     27 devlib_dir = os.path.join(os.path.dirname(__file__), 'devlib')
     28 
     29 sys.path.insert(0, os.path.join(devlib_dir, 'core'))
     30 
     31 # happends if falling back to distutils
     32 warnings.filterwarnings('ignore', "Unknown distribution option: 'install_requires'")
     33 warnings.filterwarnings('ignore', "Unknown distribution option: 'extras_require'")
     34 
     35 try:
     36     os.remove('MANIFEST')
     37 except OSError:
     38     pass
     39 
     40 packages = []
     41 data_files = {}
     42 source_dir = os.path.dirname(__file__)
     43 for root, dirs, files in os.walk(devlib_dir):
     44     rel_dir = os.path.relpath(root, source_dir)
     45     data = []
     46     if '__init__.py' in files:
     47         for f in files:
     48             if os.path.splitext(f)[1] not in ['.py', '.pyc', '.pyo']:
     49                 data.append(f)
     50         package_name = rel_dir.replace(os.sep, '.')
     51         package_dir = root
     52         packages.append(package_name)
     53         data_files[package_name] = data
     54     else:
     55         # use previous package name
     56         filepaths = [os.path.join(root, f) for f in files]
     57         data_files[package_name].extend([os.path.relpath(f, package_dir) for f in filepaths])
     58 
     59 params = dict(
     60     name='devlib',
     61     description='A framework for automating workload execution and measurment collection on ARM devices.',
     62     version='0.0.4',
     63     packages=packages,
     64     package_data=data_files,
     65     url='N/A',
     66     license='Apache v2',
     67     maintainer='ARM Ltd.',
     68     install_requires=[
     69         'python-dateutil',  # converting between UTC and local time.
     70         'pexpect>=3.3',  # Send/recieve to/from device
     71         'pyserial',  # Serial port interface
     72         'wrapt',  # Basic for construction of decorator functions
     73     ],
     74     extras_require={
     75         'daq': ['daqpower'],
     76         'doc': ['sphinx'],
     77         'monsoon': ['python-gflags'],
     78     },
     79     # https://pypi.python.org/pypi?%3Aaction=list_classifiers
     80     classifiers=[
     81         'Development Status :: 4 - Beta',
     82         'License :: OSI Approved :: Apache Software License',
     83         'Operating System :: POSIX :: Linux',
     84         'Programming Language :: Python :: 2.7',
     85     ],
     86 )
     87 
     88 all_extras = list(chain(params['extras_require'].itervalues()))
     89 params['extras_require']['full'] = all_extras
     90 
     91 setup(**params)
     92