Skip to content

Commit 4e85186

Browse files
committed
skpkg: setup.py and pyproject.toml files
1 parent 9bf31f2 commit 4e85186

2 files changed

Lines changed: 31 additions & 10 deletions

File tree

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ build-backend = "setuptools.build_meta"
66
name = "diffpy.pdffit2"
77
dynamic=['version', 'dependencies']
88
authors = [
9-
{ name="Simon J.L. Billinge group", email="simon.billinge@gmail.com" },
9+
{ name="Simon Billinge", email="sb2896@columbia.edu" },
1010
]
1111
maintainers = [
12-
{ name="Simon J.L. Billinge group", email="simon.billinge@gmail.com" },
12+
{ name="Simon Billinge", email="sb2896@columbia.edu" },
1313
]
1414
description = "PDFfit2 - real space structure refinement program."
15-
keywords = ["PDF", "structure refinement"]
15+
keywords = ['PDF', 'structure refinement']
1616
readme = "README.rst"
1717
requires-python = ">=3.11, <3.14"
1818
classifiers = [
@@ -57,7 +57,7 @@ ignore-words = ".codespell/ignore_words.txt"
5757
skip = "*.cif,*.dat,*.cc,*.h"
5858

5959
[tool.black]
60-
line-length = 115
60+
line-length = 79
6161
include = '\.pyi?$'
6262
exclude = '''
6363
/(

setup.py

100755100644
Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ def get_gsl_config():
6262
return rv
6363
else:
6464
warnings.warn(
65-
f"CONDA_PREFIX is set to {conda_prefix}, " "but GSL not found at those paths. Proceeding..."
65+
f"CONDA_PREFIX is set to {conda_prefix}, "
66+
"but GSL not found at those paths. Proceeding..."
6667
)
6768

6869
# 2. Check using GSL_PATH.
@@ -76,7 +77,8 @@ def get_gsl_config():
7677
return rv
7778
else:
7879
raise EnvironmentError(
79-
f"GSL_PATH={gsl_path} is set, but {inc} or {lib} not found. " "Please verify your GSL_PATH."
80+
f"GSL_PATH={gsl_path} is set, but {inc} or {lib} not found. "
81+
"Please verify your GSL_PATH."
8082
)
8183

8284
# 3. Try using the gsl-config executable (only on Unix-like systems).
@@ -92,8 +94,14 @@ def get_gsl_config():
9294
lib_match = re.search(r"(?m)^[^#]*\s-L(\S+)", txt)
9395
if prefix_match:
9496
prefix_path = Path(prefix_match.group(1))
95-
inc_dir = include_match.group(1) if include_match else (prefix_path / "include")
96-
lib_dir = lib_match.group(1) if lib_match else (prefix_path / "lib")
97+
inc_dir = (
98+
include_match.group(1)
99+
if include_match
100+
else (prefix_path / "include")
101+
)
102+
lib_dir = (
103+
lib_match.group(1) if lib_match else (prefix_path / "lib")
104+
)
97105
rv["include_dirs"].append(str(inc_dir))
98106
rv["library_dirs"].append(str(lib_dir))
99107
return rv
@@ -164,7 +172,14 @@ def create_extensions():
164172

165173
compiler_type = get_compiler_type()
166174
if compiler_type in ("unix", "cygwin", "mingw32"):
167-
extra_compile_args = ["-std=c++11", "-Wall", "-Wno-write-strings", "-O3", "-funroll-loops", "-ffast-math"]
175+
extra_compile_args = [
176+
"-std=c++11",
177+
"-Wall",
178+
"-Wno-write-strings",
179+
"-O3",
180+
"-funroll-loops",
181+
"-ffast-math",
182+
]
168183
# Check for static GSL libraries and add them if found.
169184
static_libs = [
170185
os.path.join(p, "libgsl.a")
@@ -189,15 +204,21 @@ def create_extensions():
189204
"extra_link_args": extra_link_args,
190205
"extra_objects": extra_objects,
191206
}
192-
ext = Extension("diffpy.pdffit2.pdffit2", glob.glob("src/extensions/**/*.cc"), **ext_kws)
207+
ext = Extension(
208+
"diffpy.pdffit2.pdffit2",
209+
glob.glob("src/extensions/**/*.cc"),
210+
**ext_kws,
211+
)
193212
return [ext]
194213

195214

215+
# Extensions not included in pyproject.toml
196216
setup_args = dict(
197217
ext_modules=[],
198218
cmdclass={"build_ext": CustomBuildExt},
199219
)
200220

221+
201222
if __name__ == "__main__":
202223
setup_args["ext_modules"] = create_extensions()
203224
setup(**setup_args)

0 commit comments

Comments
 (0)