From ce2b52d78b8e92a34b7809c8ba7533b924b63d4b Mon Sep 17 00:00:00 2001 From: Marcel Loose Date: Tue, 20 Feb 2024 17:25:39 +0100 Subject: [PATCH] Fix remote Somehow the remote did not contain the latest changes to my local branch. This should now be fixed. --- MANIFEST.in | 3 ++- casacore/.aipsrc | 2 +- casacore/__init__.py | 6 +++--- setup.py | 12 ++++++++---- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index e820fe3..1f5744c 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,5 +1,6 @@ include *.rst *.md +include casacore/.aipsrc graft casacore/data graft doc graft src -graft tests \ No newline at end of file +graft tests diff --git a/casacore/.aipsrc b/casacore/.aipsrc index 61c999f..2b3b03e 100644 --- a/casacore/.aipsrc +++ b/casacore/.aipsrc @@ -1 +1 @@ -measures.directory: ${CASACORE_DATA} \ No newline at end of file +measures.directory: ${CASACORE_DATADIR} diff --git a/casacore/__init__.py b/casacore/__init__.py index 14878de..4d7e946 100644 --- a/casacore/__init__.py +++ b/casacore/__init__.py @@ -5,9 +5,9 @@ # If environment variable `AIPSPATH` is not set, then set it to the directory # containing the `.aipsrc` file that is distributed with this package. -# This `.aipsrc` file uses the environment `CASACORE_DATA`, which should point -# to the directory containing the casacore data files. +# This `.aipsrc` file uses the environment `CASACORE_DATADIR`, which should +# point to the directory containing the casacore data files. if "AIPSPATH" not in os.environ: root = os.path.dirname(__file__) os.environ["AIPSPATH"] = root - os.environ["CASACORE_DATA"] = os.path.join(root, "data") \ No newline at end of file + os.environ["CASACORE_DATADIR"] = os.path.join(root, "data") diff --git a/setup.py b/setup.py index a36a610..d2b9eea 100755 --- a/setup.py +++ b/setup.py @@ -254,11 +254,15 @@ def get_extensions(): flag for flag in opt.split() if flag != '-Wstrict-prototypes' ) + def create_symlink(src_dir, dest_dir): """ - Create a symbolic link from `src_dir` to `dest_dir`, unless `dest_dir` already exists. + Create a symbolic link from `src_dir` to `dest_dir`, unless `dest_dir` + already exists. Return `dest_dir` upon success, or an empty string upon failure. """ + if os.path.islink(dest_dir): + os.remove(dest_dir) try: os.symlink(src_dir, dest_dir) except FileExistsError: @@ -271,7 +275,7 @@ def create_symlink(src_dir, dest_dir): class my_build_ext(build_ext_module.build_ext): def run(self): casacoreversion = find_casacore_version() - if casacoreversion is not None and LooseVersion(casacoreversion) < LooseVersion(__mincasacoreversion__): + if casacoreversion is not None and LooseVersion(casacoreversion) < LooseVersion(__mincasacoreversion__): errorstr = "Your casacore version is too old. Minimum is " + __mincasacoreversion__ + \ ", you have " + casacoreversion if casacoreversion == "2.5.0": @@ -290,10 +294,10 @@ def run(self): keywords=['pyrap', 'casacore', 'utilities', 'astronomy'], long_description=read('README.rst'), long_description_content_type='text/x-rst', - packages=find_packages() + find_namespace_packages(include=["data.*"]), + packages=find_packages() + find_namespace_packages(include=["casacore.data.*"]), include_package_data=True, package_data={ - "data": [create_symlink(os.getenv("CASACORE_DATA"), "data")] + "casacore.data": [create_symlink(os.getenv("CASACORE_DATA"), "casacore/data")] }, ext_modules=get_extensions(), cmdclass={'build_ext': my_build_ext},