yt_analysis is sharing code with you
Bitbucket is a code hosting site. Unlimited public and private repositories. Free for small teams.
Don't show this againyt / setup.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | import os
import os.path
import glob
import sys
import time
import subprocess
import distribute_setup
distribute_setup.use_setuptools()
from numpy.distutils.misc_util import appendpath
from numpy.distutils import log
DATA_FILES_HTML = glob.glob('yt/gui/reason/html/*.html')
DATA_FILES_JS = glob.glob('yt/gui/reason/html/js/*.js')
DATA_FILES_PNG = glob.glob('yt/gui/reason/html/images/*.png') \
+ glob.glob('yt/gui/reason/html/images/*.ico')
DATA_FILES_LL = glob.glob('yt/gui/reason/html/leaflet/*.js') \
+ glob.glob('yt/gui/reason/html/leaflet/*.css')
DATA_FILES_LLI = glob.glob('yt/gui/reason/html/leaflet/images/*.png')
# Verify that we have Cython installed
try:
import Cython
except ImportError as e:
print "Cython is a build-time requirement for the source tree of yt."
print "Please either install yt from a provided, release tarball,"
print "or install Cython (version 0.15 or higher)."
sys.exit(1)
######
# This next bit comes from Matthew Brett, to get Cython working with NumPy
# distutils. I added a bit to get C++ Cython working.
from os.path import join as pjoin, dirname
from distutils.dep_util import newer_group
from distutils.errors import DistutilsError
def generate_a_pyrex_source(self, base, ext_name, source, extension):
''' Monkey patch for numpy build_src.build_src method
Uses Cython instead of Pyrex.
Assumes Cython is present
'''
if self.inplace:
target_dir = dirname(base)
else:
target_dir = appendpath(self.build_src, dirname(base))
if extension.language == "c++":
cplus = True
file_ext = ".cpp"
else:
cplus = False
file_ext = ".c"
target_file = pjoin(target_dir, ext_name + file_ext)
depends = [source] + extension.depends
if self.force or newer_group(depends, target_file, 'newer'):
import Cython.Compiler.Main
log.info("cythonc:> %s" % (target_file))
self.mkpath(target_dir)
options = Cython.Compiler.Main.CompilationOptions(
defaults=Cython.Compiler.Main.default_options,
include_path=extension.include_dirs,
language=extension.language, cplus=cplus,
output_file=target_file)
cython_result = Cython.Compiler.Main.compile(source,
options=options)
if cython_result.num_errors != 0:
raise DistutilsError("%d errors while compiling %r with Cython" \
% (cython_result.num_errors, source))
return target_file
from numpy.distutils.command import build_src
build_src.build_src.generate_a_pyrex_source = generate_a_pyrex_source
# End snippet
######
import setuptools
VERSION = "2.4dev"
if os.path.exists('MANIFEST'): os.remove('MANIFEST')
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration(None, parent_package, top_path)
config.set_options(ignore_setup_xxx_py=True,
assume_default_configuration=True,
delegate_options_to_subpackages=True,
quiet=True)
config.make_config_py()
#config.make_svn_version_py()
config.add_subpackage('yt', 'yt')
config.add_scripts("scripts/*")
return config
def setup_package():
from numpy.distutils.core import setup
setup(
name="yt",
version=VERSION,
description="An analysis and visualization toolkit for Astrophysical "
+ "simulations, focusing on Adaptive Mesh Refinement data "
"from Enzo, Orion, FLASH, and others.",
classifiers=["Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: GNU General Public License (GPL)",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX :: AIX",
"Operating System :: POSIX :: Linux",
"Programming Language :: C",
"Programming Language :: Python",
"Topic :: Scientific/Engineering :: Astronomy",
"Topic :: Scientific/Engineering :: Physics",
"Topic :: Scientific/Engineering :: Visualization"],
keywords='astronomy astrophysics visualization ' + \
'amr adaptivemeshrefinement',
entry_points={'console_scripts': [
'yt = yt.utilities.command_line:run_main',
]},
author="Matthew J. Turk",
author_email="matthewturk@gmail.com",
url="http://yt-project.org/",
license="GPL-3",
configuration=configuration,
zip_safe=False,
data_files=[('yt/gui/reason/html/', DATA_FILES_HTML),
('yt/gui/reason/html/js/', DATA_FILES_JS),
('yt/gui/reason/html/images/', DATA_FILES_PNG),
('yt/gui/reason/html/leaflet/', DATA_FILES_LL),
('yt/gui/reason/html/leaflet/images', DATA_FILES_LLI)],
)
return
if __name__ == '__main__':
setup_package()
|