LLNL-PyDV 3.4.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
pydv/scripts/date.txt ADDED
@@ -0,0 +1 @@
1
+ 07.08.2024
@@ -0,0 +1,64 @@
1
+
2
+ from datetime import date
3
+ import os
4
+ import argparse
5
+ import fileinput
6
+
7
+ SCRIPTS_DIR = os.path.dirname(os.path.abspath(__file__))
8
+ SOURCE_DIR = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))), 'pydv')
9
+ ROOT_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
10
+
11
+ # Get the version number from the version file
12
+ version_file = os.path.join(SCRIPTS_DIR, 'version.txt')
13
+ with open(version_file, 'r') as fp:
14
+ version = fp.read()
15
+ version_list = version.split('.')
16
+ major, minor, patch = int(version_list[0]), int(version_list[1]), int(version_list[2])
17
+
18
+ # Determine the new version from the specified type of change
19
+ parser = argparse.ArgumentParser()
20
+ parser.add_argument('type', choices=['major', 'minor', 'patch', 'date'])
21
+ args = parser.parse_args().type
22
+ if args == 'major':
23
+ major += 1
24
+ minor = 0
25
+ patch = 0
26
+ elif args == 'minor':
27
+ minor += 1
28
+ patch = 0
29
+ elif args == 'patch':
30
+ patch += 1
31
+ new_version = f'{major}.{minor}.{patch}'
32
+
33
+ # Replace the version everwhere in the source code where it appears.
34
+ files = [
35
+ os.path.join(ROOT_DIR, 'pyproject.toml'),
36
+ os.path.join(ROOT_DIR, '.github', 'workflows', 'release.yml'),
37
+ os.path.join(SOURCE_DIR, 'pdvplot.py'),
38
+ os.path.join(SOURCE_DIR, 'pdv.py'),
39
+ os.path.join(ROOT_DIR, 'docs', 'conf.py'),
40
+ os.path.join(SCRIPTS_DIR, 'version.txt'),
41
+ ]
42
+ for afile in files:
43
+ with fileinput.FileInput(afile, inplace=True) as fp:
44
+ for line in fp:
45
+ print(line.replace(version, new_version), end='')
46
+
47
+ # Special case: the conf.py file also wants a representation of just major.minor
48
+ with fileinput.FileInput(os.path.join(ROOT_DIR, 'docs', 'conf.py'), inplace=True) as fp:
49
+ for line in fp:
50
+ print(line.replace(f'{version_list[0]}.{version_list[1]}', f'{major}.{minor}'), end='')
51
+
52
+ # Replace the date
53
+ with open(os.path.join(SCRIPTS_DIR, 'date.txt')) as fp:
54
+ old_date = fp.read()
55
+ new_date = date.today()
56
+ new_date = f'{new_date.month:02d}.{new_date.day:02d}.{new_date.year:04d}'
57
+ files = [
58
+ os.path.join(SOURCE_DIR, 'pdv.py'),
59
+ os.path.join(SCRIPTS_DIR, 'date.txt'),
60
+ ]
61
+ for afile in files:
62
+ with fileinput.FileInput(afile, inplace=True) as fp:
63
+ for line in fp:
64
+ print(line.replace(old_date, new_date), end='')
@@ -0,0 +1 @@
1
+ 3.4.3