<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys

if any((x in sys.argv for x in ('develop','bdist'))):
    # use setuptools for develop, but nothing else
    from setuptools import setup
    Command = object
else:
    from distutils.core import setup, Command

with open('README.rst') as file:
    long_description = file.read()

#with open('CHANGES') as file:
#    long_description += file.read()

__version__ = ""
execfile('pyradex/version.py') # sets version

#import os
#if not os.path.exists('pyradex/radex/radex.so'):
#    import install_radex
#    install_radex.install_radex()

class InstallRadex(Command):
    """
    Compile the f2py radex modules needed for the python wrapper
    """

    user_options = []

    def initialize_options(self):
        pass

    def finalize_options(self):
        pass

    def run(self):
        import install_radex
        install_radex.install_radex()

class BuildRadexExecutable(Command):
    """
    Create the files radex_sphere, radex_lvg, radex_slab in the Radex/bin/
    directory
    """

    user_options = []

    def initialize_options(self):
        pass

    def finalize_options(self):
        pass

    def run(self):
        import install_radex
        install_radex.build_radex_executable()


class InstallFjdu(Command):
    """
    Compile Fujun Du's "myradex"
    """
    user_options = []

    def initialize_options(self):
        pass

    def finalize_options(self):
        pass

    def run(self):
        cwd = os.getcwd()
        os.chdir('myRadex')
        os.system('make wrapper')
        os.chdir(cwd)
        os.link('myRadex/wrapper_my_radex.so', 'pyradex/fjdu/myradex.so')


import subprocess
import shutil
import os

class PyTest(Command):

    user_options = []

    def initialize_options(self):
        pass

    def finalize_options(self):
        pass

    def run(self):

        if os.path.exists('build'):
            shutil.rmtree('build')
        #errno1 = subprocess.call(['py.test','--genscript=runtests.py'])
        errno2 = subprocess.call([sys.executable, 'runtests.py'])
        raise SystemExit(errno2)

setup(name='pyradex',
      version=__version__,
      description='Python-RADEX',
      long_description=long_description,
      author='<NAME> & <NAME>',
      author_email='<EMAIL>',
      url='http://github.com/keflavich/pyradex/',
      packages=['pyradex','pyradex.radex','pyradex.tests'],
      package_data={'pyradex.radex':['radex.so'],
                    'pyradex.tests':['data/example.out']},
      requires=['requests', 'astroquery', ],
      install_requires=['astropy>=0.4.1', 'requests>=2.4.1',],
      cmdclass={'test': PyTest,
                'install_radex': InstallRadex,
                'build_radex_exe': BuildRadexExecutable,
                'install_myradex': InstallFjdu,
                'install_fjdu': InstallFjdu,
               },
      #include_package_data=True,
      )<commit_msg>finish installation component<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys

if any((x in sys.argv for x in ('develop','bdist'))):
    # use setuptools for develop, but nothing else
    from setuptools import setup
    Command = object
else:
    from distutils.core import setup, Command

with open('README.rst') as file:
    long_description = file.read()

#with open('CHANGES') as file:
#    long_description += file.read()

__version__ = ""
execfile('pyradex/version.py') # sets version

#import os
#if not os.path.exists('pyradex/radex/radex.so'):
#    import install_radex
#    install_radex.install_radex()

class InstallRadex(Command):
    """
    Compile the f2py radex modules needed for the python wrapper
    """

    user_options = []

    def initialize_options(self):
        pass

    def finalize_options(self):
        pass

    def run(self):
        import install_radex
        install_radex.install_radex()

class BuildRadexExecutable(Command):
    """
    Create the files radex_sphere, radex_lvg, radex_slab in the Radex/bin/
    directory
    """

    user_options = []

    def initialize_options(self):
        pass

    def finalize_options(self):
        pass

    def run(self):
        import install_radex
        install_radex.build_radex_executable()


class InstallFjdu(Command):
    """
    Compile Fujun Du's "myradex"
    """
    user_options = []

    def initialize_options(self):
        pass

    def finalize_options(self):
        pass

    def run(self):
        cwd = os.getcwd()
        os.chdir('myRadex')
        os.system('make wrapper')
        os.chdir(cwd)
        try:
            os.link('myRadex/wrapper_my_radex.so', 'pyradex/fjdu/myradex.so')
        except OSError as ex:
            if ex.errno == 17:
                # file exists
                pass
            else:
                raise ex


import subprocess
import shutil
import os

class PyTest(Command):

    user_options = []

    def initialize_options(self):
        pass

    def finalize_options(self):
        pass

    def run(self):

        if os.path.exists('build'):
            shutil.rmtree('build')
        #errno1 = subprocess.call(['py.test','--genscript=runtests.py'])
        errno2 = subprocess.call([sys.executable, 'runtests.py'])
        raise SystemExit(errno2)

setup(name='pyradex',
      version=__version__,
      description='Python-RADEX',
      long_description=long_description,
      author='<NAME> & <NAME>',
      author_email='<EMAIL>',
      url='http://github.com/keflavich/pyradex/',
      packages=['pyradex','pyradex.radex','pyradex.tests'],
      package_data={'pyradex.radex':['radex.so'],
                    'pyradex.fjdu':['myradex.so'],
                    'pyradex.tests':['data/example.out']},
      requires=['requests', 'astroquery', ],
      install_requires=['astropy>=0.4.1', 'requests>=2.4.1',],
      cmdclass={'test': PyTest,
                'install_radex': InstallRadex,
                'build_radex_exe': BuildRadexExecutable,
                'install_myradex': InstallFjdu,
                'install_fjdu': InstallFjdu,
               },
      #include_package_data=True,
      )
{'fraction_non_alphanumeric': 0.1276734693877551, 'fraction_numerical': 0.003918367346938775, 'mean_word_length': 2.538994800693241, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2571242', 'n_tokens_mistral': 2004, 'n_tokens_neox': 1961, 'n_words': 379}