Skip to content

Commit

Permalink
PEP 8
Browse files Browse the repository at this point in the history
  • Loading branch information
Bill Ladwig committed Feb 1, 2019
1 parent 7c2b7d1 commit a96dbd3
Show file tree
Hide file tree
Showing 2 changed files with 109 additions and 106 deletions.
79 changes: 41 additions & 38 deletions chey_intel.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

def intel_version_match(type):
# Match against the important stuff in the version string
return simple_version_match(start=r'Intel.*?Fortran.*?(?:%s).*?Version' % (type,))
return simple_version_match(
start=r'Intel.*?Fortran.*?(?:%s).*?Version'.format(type,))


class BaseIntelFCompiler(FCompiler):
Expand All @@ -36,13 +37,13 @@ class IntelFCompiler(BaseIntelFCompiler):
possible_executables = ['ifort', 'ifc']

executables = {
'version_cmd' : None, # set by update_executables
'compiler_f77' : [None, "-72", "-w90", "-w95"],
'compiler_f90' : [None],
'compiler_fix' : [None, "-FI"],
'linker_so' : ["<F90>", "-shared"],
'archiver' : ["ar", "-cr"],
'ranlib' : ["ranlib"]
'version_cmd': None, # set by update_executables
'compiler_f77': [None, "-72", "-w90", "-w95"],
'compiler_f90': [None],
'compiler_fix': [None, "-FI"],
'linker_so': ["<F90>", "-shared"],
'archiver': ["ar", "-cr"],
'ranlib': ["ranlib"]
}

pic_flags = ['-fPIC']
Expand Down Expand Up @@ -89,13 +90,13 @@ class IntelItaniumFCompiler(IntelFCompiler):
possible_executables = ['ifort', 'efort', 'efc']

executables = {
'version_cmd' : None,
'compiler_f77' : [None, "-FI", "-w90", "-w95"],
'compiler_fix' : [None, "-FI"],
'compiler_f90' : [None],
'linker_so' : ['<F90>', "-shared"],
'archiver' : ["ar", "-cr"],
'ranlib' : ["ranlib"]
'version_cmd': None,
'compiler_f77': [None, "-FI", "-w90", "-w95"],
'compiler_fix': [None, "-FI"],
'compiler_f90': [None],
'linker_so': ['<F90>', "-shared"],
'archiver': ["ar", "-cr"],
'ranlib': ["ranlib"]
}


Expand All @@ -104,18 +105,19 @@ class IntelEM64TFCompiler(IntelFCompiler):
compiler_aliases = ()
description = 'Intel Fortran Compiler for 64-bit apps'

version_match = intel_version_match('EM64T-based|Intel\\(R\\) 64|64|IA-64|64-bit')
version_match = intel_version_match(
'EM64T-based|Intel\\(R\\) 64|64|IA-64|64-bit')

possible_executables = ['ifort', 'efort', 'efc']

executables = {
'version_cmd' : None,
'compiler_f77' : [None, "-FI"],
'compiler_fix' : [None, "-FI"],
'compiler_f90' : [None],
'linker_so' : ['<F90>', "-shared"],
'archiver' : ["ar", "-cr"],
'ranlib' : ["ranlib"]
'version_cmd': None,
'compiler_f77': [None, "-FI"],
'compiler_fix': [None, "-FI"],
'compiler_f90': [None],
'linker_so': ['<F90>', "-shared"],
'archiver': ["ar", "-cr"],
'ranlib': ["ranlib"]
}

def get_flags(self):
Expand Down Expand Up @@ -147,13 +149,13 @@ def update_executables(self):
possible_executables = ['ifort', 'ifl']

executables = {
'version_cmd' : None,
'compiler_f77' : [None],
'compiler_fix' : [None],
'compiler_f90' : [None],
'linker_so' : [None],
'archiver' : [ar_exe, "/verbose", "/OUT:"],
'ranlib' : None
'version_cmd': None,
'compiler_f77': [None],
'compiler_fix': [None],
'compiler_f90': [None],
'linker_so': [None],
'archiver': [ar_exe, "/verbose", "/OUT:"],
'ranlib': None
}

compile_switch = '/c '
Expand All @@ -163,7 +165,8 @@ def update_executables(self):
module_include_switch = '/I'

def get_flags(self):
opt = ['/nologo', '/MD', '/nbs', '/names:lowercase', '/assume:underscore']
opt = ['/nologo', '/MD', '/nbs', '/names:lowercase',
'/assume:underscore']
return opt

def get_flags_free(self):
Expand Down Expand Up @@ -192,13 +195,13 @@ class IntelItaniumVisualFCompiler(IntelVisualFCompiler):
ar_exe = IntelVisualFCompiler.ar_exe

executables = {
'version_cmd' : None,
'compiler_f77' : [None, "-FI", "-w90", "-w95"],
'compiler_fix' : [None, "-FI", "-4L72", "-w"],
'compiler_f90' : [None],
'linker_so' : ['<F90>', "-shared"],
'archiver' : [ar_exe, "/verbose", "/OUT:"],
'ranlib' : None
'version_cmd': None,
'compiler_f77': [None, "-FI", "-w90", "-w95"],
'compiler_fix': [None, "-FI", "-4L72", "-w"],
'compiler_f90': [None],
'linker_so': ['<F90>', "-shared"],
'archiver': [ar_exe, "/verbose", "/OUT:"],
'ranlib': None
}


Expand Down
136 changes: 68 additions & 68 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import chey_intel
import numpy.distutils.core
import numpy.distutils.fcompiler.intel

numpy.distutils.fcompiler.intel.IntelFCompiler = chey_intel.IntelFCompiler
numpy.distutils.fcompiler.intel.IntelVisualFCompiler = (
chey_intel.IntelVisualFCompiler)
Expand All @@ -31,33 +31,33 @@
chey_intel.IntelEM64TFCompiler)

ext1 = numpy.distutils.core.Extension(
name = "wrf._wrffortran",
sources = ["fortran/wrf_constants.f90",
"fortran/wrf_testfunc.f90",
"fortran/wrf_user.f90",
"fortran/rip_cape.f90",
"fortran/wrf_cloud_fracf.f90",
"fortran/wrf_fctt.f90",
"fortran/wrf_user_dbz.f90",
"fortran/wrf_relhl.f90",
"fortran/calc_uh.f90",
"fortran/wrf_user_latlon_routines.f90",
"fortran/wrf_pvo.f90",
"fortran/eqthecalc.f90",
"fortran/wrf_rip_phys_routines.f90",
"fortran/wrf_pw.f90",
"fortran/wrf_vinterp.f90",
"fortran/wrf_wind.f90",
"fortran/omp.f90"]
name="wrf._wrffortran",
sources=["fortran/wrf_constants.f90",
"fortran/wrf_testfunc.f90",
"fortran/wrf_user.f90",
"fortran/rip_cape.f90",
"fortran/wrf_cloud_fracf.f90",
"fortran/wrf_fctt.f90",
"fortran/wrf_user_dbz.f90",
"fortran/wrf_relhl.f90",
"fortran/calc_uh.f90",
"fortran/wrf_user_latlon_routines.f90",
"fortran/wrf_pvo.f90",
"fortran/eqthecalc.f90",
"fortran/wrf_rip_phys_routines.f90",
"fortran/wrf_pw.f90",
"fortran/wrf_vinterp.f90",
"fortran/wrf_wind.f90",
"fortran/omp.f90"]
)

with open("src/wrf/version.py") as f:
with open("src/wrf/version.py") as f:
exec(f.read())

on_rtd = os.environ.get("READTHEDOCS", None) == "True"
#on_rtd=True
# on_rtd=True
if on_rtd:
if sys.version_info < (3,3):
if sys.version_info < (3, 3):
requirements = ["mock"] # for python2 and python < 3.3
else:
requirements = [] # for >= python3.3
Expand All @@ -67,53 +67,53 @@
# Place install_requires into the text file "requirements.txt"
with open("requirements.txt") as f2:
requirements = f2.read().strip().splitlines()
#if sys.version_info < (3,3):
# requirements.append("mock")

# if sys.version_info < (3,3):
# requirements.append("mock")
ext_modules = [ext1]


numpy.distutils.core.setup(
author = "Bill Ladwig",
author_email = "[email protected]",
description = "Diagnostic and interpolation routines for WRF-ARW data.",
long_description = ("A collection of diagnostic and interpolation routines "
"to be used with WRF-ARW data.\n\n"
"GitHub Repository:\n\n"
"https://github.com/NCAR/wrf-python\n\n"
"Documentation:\n\n"
"http://wrf-python.rtfd.org\n"),
url = "https://github.com/NCAR/wrf-python",
keywords = ["python", "wrf-python", "wrf", "forecast", "model",
"weather research and forecasting", "interpolation",
"plotting", "plots", "meteorology", "nwp",
"numerical weather prediction", "diagnostic",
"science", "numpy"],
install_requires = requirements,
classifiers = ["Development Status :: 5 - Production/Stable",
"Intended Audience :: Science/Research",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Fortran",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Topic :: Scientific/Engineering :: Atmospheric Science",
"Topic :: Software Development",
"Operating System :: POSIX",
"Operating System :: Unix",
"Operating System :: MacOS",
"Operating System :: Microsoft :: Windows"],
name = "wrf-python",
platforms = ["any"],
license = "Apache License 2.0",
version = __version__,
packages = setuptools.find_packages("src"),
ext_modules = ext_modules,
package_dir = {"" : "src"},
download_url = "http://python.org/pypi/wrf-python",
package_data={"wrf" : ["data/psadilookup.dat"]},
numpy.distutils.core.setup(
author="Bill Ladwig",
author_email="[email protected]",
description="Diagnostic and interpolation routines for WRF-ARW data.",
long_description=("A collection of diagnostic and interpolation "
"routines to be used with WRF-ARW data.\n\n"
"GitHub Repository:\n\n"
"https://github.com/NCAR/wrf-python\n\n"
"Documentation:\n\n"
"http://wrf-python.rtfd.org\n"),
url="https://github.com/NCAR/wrf-python",
keywords=["python", "wrf-python", "wrf", "forecast", "model",
"weather research and forecasting", "interpolation",
"plotting", "plots", "meteorology", "nwp",
"numerical weather prediction", "diagnostic",
"science", "numpy"],
install_requires=requirements,
classifiers=["Development Status :: 5 - Production/Stable",
"Intended Audience :: Science/Research",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Fortran",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Topic :: Scientific/Engineering :: Atmospheric Science",
"Topic :: Software Development",
"Operating System :: POSIX",
"Operating System :: Unix",
"Operating System :: MacOS",
"Operating System :: Microsoft :: Windows"],
name="wrf-python",
platforms=["any"],
license="Apache License 2.0",
version=__version__,
packages=setuptools.find_packages("src"),
ext_modules=ext_modules,
package_dir={"": "src"},
download_url="http://python.org/pypi/wrf-python",
package_data={"wrf": ["data/psadilookup.dat"]},
scripts=[]
)
)

0 comments on commit a96dbd3

Please sign in to comment.