Skip to content

Commit

Permalink
Link to NAPI manual directly (#1298)
Browse files Browse the repository at this point in the history
Remove copying in build and download functions. Fixes #1296

Remove unused import
  • Loading branch information
PeterC-DLS authored Jun 21, 2023
1 parent 83221cc commit 2635a44
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 40 deletions.
18 changes: 0 additions & 18 deletions dev_tools/apps/manual_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from ..nxdl import validate_definition
from ..utils.copy import copy_files
from ..utils.copy import copydir
from ..utils.copy import download_files
from ..utils.diff import diff_ascii
from .nxclass_app import diff_nxclass_docs
from .nxclass_app import save_nxclass_docs
Expand Down Expand Up @@ -113,26 +112,9 @@ def manual_exec(args):
print("generate anchor list files in", output_path)
anchor_registry.write()
copy_files(EXTRA_FILES)
download_files(EXTRA_URLS)


# Path relative to source directory,
# Path relative to build directory,
# Overwrite (boolean)
EXTRA_FILES = [["NXDL_VERSION", "NXDL_VERSION", True], ["LGPL.txt", "LGPL.txt", True]]

# URL,
# Path relative to build directory,
# Overwrite (boolean)
EXTRA_URLS = [
[
"https://github.com/nexusformat/code/raw/master/doc/api/NeXusIntern.pdf",
"manual/source/_static/NeXusIntern.pdf",
False,
],
[
"https://github.com/nexusformat/code/raw/master/applications/NXtranslate/docs/NXtranslate.pdf",
"manual/source/_static/NXtranslate.pdf",
False,
],
]
20 changes: 0 additions & 20 deletions dev_tools/utils/copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
from typing import List
from typing import Tuple

import requests

from ..globals import directories


Expand All @@ -20,14 +18,6 @@ def copydir(from_path: Path, to_path: Path) -> None:
shutil.copytree(from_path, to_path, dirs_exist_ok=True)


def download(url: str, to_path: Path) -> None:
print("download", url)
print(" ->", to_path)
r = requests.get(url)
with open(to_path, "wb") as fh:
fh.write(r.content)


def copy_files(files: List[Tuple[str, str, bool]]) -> None:
source_root = directories.get_source_root()
build_root = directories.get_build_root()
Expand All @@ -38,13 +28,3 @@ def copy_files(files: List[Tuple[str, str, bool]]) -> None:
copyfile(from_path, to_path)
else:
print("already exists", to_path)


def download_files(urls: List[Tuple[str, str, bool]]) -> None:
build_root = directories.get_build_root()
for url, subname, overwrite in urls:
to_path = build_root / subname
if overwrite or not to_path.exists():
download(url, to_path)
else:
print("already exists", to_path)
2 changes: 1 addition & 1 deletion manual/source/design.rst
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ a URL to a group in another file. More information about the
``@napimount`` attribute is described in the
*NeXus Programmers Reference*. [#]_

.. [#] https://manual.nexusformat.org/_static/NeXusIntern.pdf
.. [#] https://github.com/nexusformat/code/raw/master/doc/api/NeXusIntern.pdf
.. index:: link; external file, NeXus link

Expand Down
2 changes: 1 addition & 1 deletion manual/source/introduction-napi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ in the :ref:`NAPI <NAPI>` chapter and may be downloaded
from the NeXus development site. [#]_

For an even more detailed description of the internal workings of NAPI
see the `NeXus Internals manual <https://manual.nexusformat.org/_static/NeXusIntern.pdf>`_, copied from the NeXus code repository.
see the `NeXus Internals manual <https://github.com/nexusformat/code/raw/master/doc/api/NeXusIntern.pdf>`_, copied from the NeXus code repository.
That document is written for programmers who want to work on the NAPI itself.
If you are new to NeXus and just want to implement basic file reading or writing
you should not start by reading that.
Expand Down

0 comments on commit 2635a44

Please sign in to comment.