1#!/usr/bin/env python3 2 3from os import path, walk 4 5import sys 6from setuptools import setup, find_packages, Command 7import subprocess 8 9NAME = "Orange3-SingleCell" 10 11VERSION = "0.8.2" 12 13DESCRIPTION = "Add-on for bioinformatics analysis of single cell data" 14LONG_DESCRIPTION = open(path.join(path.dirname(__file__), 'README.md')).read() 15AUTHOR = 'Bioinformatics Laboratory, FRI UL' 16AUTHOR_EMAIL = 'info@biolab.si' 17URL = "https://github.com/biolab/orange3-single-cell" 18DOWNLOAD_URL = "https://github.com/biolab/orange3-single-cell/tarball/{}".format(VERSION) 19LICENSE = 'GPLv3+' 20 21KEYWORDS = ( 22 # [PyPi](https://pypi.python.org) packages with keyword "orange3 add-on" 23 # can be installed using the Orange Add-on Manager 24 'orange3 add-on', 25) 26 27PACKAGES = find_packages() 28 29PACKAGE_DATA = { 30 'orangecontrib.single_cell.tutorials': ['*.ows', '*.tsv', '*.mtx', '*.tab.gz', '*.tab'], 31 'orangecontrib.single_cell.tests': ['*'], 32 'orangecontrib.single_cell.launcher.icons': ['*.ows', '*.png'], 33 'orangecontrib.single_cell.widgets.icons': ['*.ows'] 34} 35 36DATA_FILES = [ 37 # Data files that will be installed outside site-packages folder 38] 39 40INSTALL_REQUIRES = sorted(set( 41 line.partition('#')[0].strip() 42 for line in open(path.join(path.dirname(__file__), 'requirements.txt')) 43) - {''}) 44 45ENTRY_POINTS = { 46 # Entry points that marks this package as an orange add-on. If set, addon will 47 # be shown in the add-ons manager even if not published on PyPi. 48 'orange3.addon': ( 49 'single_cell = orangecontrib.single_cell', 50 ), 51 # Entry point used to specify packages containing tutorials accessible 52 # from welcome screen. Tutorials are saved Orange Workflows (.ows files). 53 'orange.widgets.tutorials': ( 54 # Syntax: any_text = path.to.package.containing.tutorials 55 'vcftutorials = orangecontrib.single_cell.tutorials', 56 ), 57 58 # Entry point used to specify packages containing widgets. 59 'orange.widgets': ( 60 # Syntax: category name = path.to.package.containing.widgets 61 # Widget category specification can be seen in 62 # orangecontrib/example/widgets/__init__.py 63 'Single Cell = orangecontrib.single_cell.widgets', 64 ), 65 66 # Register widget help 67 "orange.canvas.help": ( 68 'html-index = orangecontrib.single_cell.widgets:WIDGET_HELP_PATH',) 69} 70 71NAMESPACE_PACKAGES = ["orangecontrib"] 72 73TEST_SUITE = "orangecontrib.single_cell.tests.suite" 74 75 76def include_documentation(local_dir, install_dir): 77 global DATA_FILES 78 if (('bdist_wheel' in sys.argv) or ('install' in sys.argv))\ 79 and not path.exists(local_dir): 80 print("Directory '{}' does not exist. " 81 "Please build documentation before running bdist_wheel." 82 .format(path.abspath(local_dir))) 83 sys.exit(0) 84 85 doc_files = [] 86 for dirpath, dirs, files in walk(local_dir): 87 doc_files.append((dirpath.replace(local_dir, install_dir), 88 [path.join(dirpath, f) for f in files])) 89 DATA_FILES.extend(doc_files) 90 91 92class CoverageCommand(Command): 93 """A setup.py coverage subcommand developers can run locally.""" 94 description = "run code coverage" 95 user_options = [] 96 initialize_options = finalize_options = lambda self: None 97 98 def check_requirements(self): 99 100 try: 101 import coverage 102 except ImportError as e: 103 raise e 104 105 def run(self): 106 """Check coverage on current workdir""" 107 self.check_requirements() 108 109 sys.exit(subprocess.call(r''' 110 coverage run setup.py test 111 echo; echo 112 coverage report 113 coverage html && 114 { echo; echo "See also: file://$(pwd)/coverage_html_report/index.html"; echo; } 115 ''', shell=True, cwd=path.dirname(path.abspath(__file__)))) 116 117 118if __name__ == '__main__': 119 include_documentation('doc/build/htmlhelp', 'help/orange3-single_cell') 120 121 cmdclass = { 122 'coverage': CoverageCommand, 123 } 124 125 setup( 126 name=NAME, 127 version=VERSION, 128 description=DESCRIPTION, 129 long_description=LONG_DESCRIPTION, 130 author=AUTHOR, 131 author_email=AUTHOR_EMAIL, 132 url=URL, 133 download_url=DOWNLOAD_URL, 134 license=LICENSE, 135 packages=PACKAGES, 136 package_data=PACKAGE_DATA, 137 data_files=DATA_FILES, 138 install_requires=INSTALL_REQUIRES, 139 entry_points=ENTRY_POINTS, 140 keywords=KEYWORDS, 141 namespace_packages=NAMESPACE_PACKAGES, 142 test_suite=TEST_SUITE, 143 include_package_data=True, 144 zip_safe=False, 145 cmdclass=cmdclass 146 ) 147