form-bin 5.0.0a4__tar.gz

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.
@@ -0,0 +1,68 @@
1
+ Metadata-Version: 2.1
2
+ Name: form-bin
3
+ Version: 5.0.0a4
4
+ Summary: The FORM project for symbolic manipulation of very big expressions
5
+ Requires-Python: >=3.10
6
+ License: GPL-3.0-or-later
7
+ Project-URL: homepage, https://www.nikhef.nl/~form
8
+ Project-URL: source, https://github.com/form-dev/form
9
+ Project-URL: documentation, https://form-dev.github.io/form-docs/stable/manual/
10
+ Project-URL: issues, https://github.com/form-dev/form/issues
11
+ Project-URL: wiki, https://github.com/form-dev/form/wiki
12
+ Project-URL: discussions, https://github.com/form-dev/form/discussions
13
+ Description-Content-Type: text/markdown
14
+
15
+
16
+ FORM
17
+ ====
18
+
19
+ FORM is a Symbolic Manipulation System. It reads symbolic expressions from files and executes symbolic/algebraic transformations upon them. The answers are returned in a textual mathematical representation. As its landmark feature, the size of the considered expressions in FORM is only limited by the available disk space and not by the available RAM. FORM has been essential for many state-of-the-art computations in High Energy Physics.
20
+
21
+ FORM's original author is Jos Vermaseren of NIKHEF, the Dutch institute for subatomic physics. Other people that have made contributions can be found in the file "[AUTHORS](AUTHORS)".
22
+
23
+ Quick examples
24
+ --------------
25
+
26
+ The following FORM program repeatedly matches the power of a variable `x` in the expression `E`, as long as the power is more than 1 and creates two new terms with lower power:
27
+
28
+ ```form
29
+ Symbol x,n;
30
+ Local E = x^10;
31
+
32
+ repeat id x^n?{>1} = x^(n-1) + x^(n-2);
33
+
34
+ Print;
35
+ .end
36
+ ```
37
+
38
+ and yields `E = 34 + 55*x`.
39
+
40
+ The following FORM program matches the function `f` that has any arguments before encountering an `x` and any arguments after, and switches them around:
41
+
42
+ ```form
43
+ CFunction f;
44
+ Symbol x;
45
+ Local E = f(1,2,x,3,4);
46
+
47
+ id f(?a,x,?b) = f(?b,?a);
48
+
49
+ Print;
50
+ .end
51
+ ```
52
+
53
+ and yields `E = f(3,4,1,2)`.
54
+
55
+ FORM can match many more complicated patterns and has many more features, as documented in the [additional information](#additional-information).
56
+
57
+
58
+ Additional information
59
+ ----------------------
60
+
61
+ The latest release notes are available on the [Wiki](https://github.com/form-dev/form/wiki/Release-Notes-FORM-5.0.0); the latest reference manual can be found [here](https://form-dev.github.io/form-docs/stable/manual/), and the Form Cookbook can be found [here](https://github.com/form-dev/form/wiki/FORM-Cookbook).
62
+
63
+ More background information, a collection of FORM programs, and a number of courses can be found on the official [FORM website](http://www.nikhef.nl/~form) and on the [Wiki](https://github.com/form-dev/form/wiki).
64
+
65
+
66
+ Bugs and remarks
67
+ ----------------
68
+ For reporting bugs, asking questions, giving remarks and suggestions, we welcome you to use the [Issue Tracker](https://github.com/form-dev/form/issues) or [Discussion Forum](https://github.com/form-dev/form/discussions).
@@ -0,0 +1,53 @@
1
+ FORM
2
+ ====
3
+
4
+ FORM is a Symbolic Manipulation System. It reads symbolic expressions from files and executes symbolic/algebraic transformations upon them. The answers are returned in a textual mathematical representation. As its landmark feature, the size of the considered expressions in FORM is only limited by the available disk space and not by the available RAM. FORM has been essential for many state-of-the-art computations in High Energy Physics.
5
+
6
+ FORM's original author is Jos Vermaseren of NIKHEF, the Dutch institute for subatomic physics. Other people that have made contributions can be found in the file "[AUTHORS](AUTHORS)".
7
+
8
+ Quick examples
9
+ --------------
10
+
11
+ The following FORM program repeatedly matches the power of a variable `x` in the expression `E`, as long as the power is more than 1 and creates two new terms with lower power:
12
+
13
+ ```form
14
+ Symbol x,n;
15
+ Local E = x^10;
16
+
17
+ repeat id x^n?{>1} = x^(n-1) + x^(n-2);
18
+
19
+ Print;
20
+ .end
21
+ ```
22
+
23
+ and yields `E = 34 + 55*x`.
24
+
25
+ The following FORM program matches the function `f` that has any arguments before encountering an `x` and any arguments after, and switches them around:
26
+
27
+ ```form
28
+ CFunction f;
29
+ Symbol x;
30
+ Local E = f(1,2,x,3,4);
31
+
32
+ id f(?a,x,?b) = f(?b,?a);
33
+
34
+ Print;
35
+ .end
36
+ ```
37
+
38
+ and yields `E = f(3,4,1,2)`.
39
+
40
+ FORM can match many more complicated patterns and has many more features, as documented in the [additional information](#additional-information).
41
+
42
+
43
+ Additional information
44
+ ----------------------
45
+
46
+ The latest release notes are available on the [Wiki](https://github.com/form-dev/form/wiki/Release-Notes-FORM-5.0.0); the latest reference manual can be found [here](https://form-dev.github.io/form-docs/stable/manual/), and the Form Cookbook can be found [here](https://github.com/form-dev/form/wiki/FORM-Cookbook).
47
+
48
+ More background information, a collection of FORM programs, and a number of courses can be found on the official [FORM website](http://www.nikhef.nl/~form) and on the [Wiki](https://github.com/form-dev/form/wiki).
49
+
50
+
51
+ Bugs and remarks
52
+ ----------------
53
+ For reporting bugs, asking questions, giving remarks and suggestions, we welcome you to use the [Issue Tracker](https://github.com/form-dev/form/issues) or [Discussion Forum](https://github.com/form-dev/form/discussions).
@@ -0,0 +1,49 @@
1
+ import enscons
2
+ import os
3
+ import packaging.tags
4
+ import subprocess
5
+ import sys
6
+ import toml
7
+
8
+ def get_universal_platform_tag():
9
+ """Return the wheel tag for universal Python 3, but specific platform."""
10
+ tag = next(packaging.tags.sys_tags())
11
+ return f"py3-none-{tag.platform}"
12
+
13
+ pyproject = toml.load("pyproject.toml")
14
+
15
+ env = Environment(
16
+ tools=["default", "packaging", enscons.generate],
17
+ PACKAGE_METADATA=pyproject["project"],
18
+ WHEEL_TAG=get_universal_platform_tag(),
19
+ ENV=os.environ
20
+ )
21
+
22
+ hepware_form = env.Command(
23
+ ["hepware/form.done", "hepware/bin/tform"],
24
+ ["hepware/Makefile"],
25
+ "make -C hepware -j6 form.done",
26
+ )
27
+
28
+ files = [
29
+ File("form-packages/README.md"),
30
+ File("form_bin/__init__.py"),
31
+ File("form_bin/__main__.py"),
32
+ env.Command(
33
+ "form_bin/tform",
34
+ [hepware_form],
35
+ ["cp hepware/bin/tform form_bin/tform", "strip form_bin/tform"],
36
+ ),
37
+ ]
38
+
39
+ platformlib = env.Whl("platlib", files, root="")
40
+ bdist = env.WhlFile(source=platformlib)
41
+
42
+ # FindSourceFiles() will list every source file of every target
43
+ # defined so far.
44
+ File("PKG-INFO")
45
+ sdist = env.SDist(source=FindSourceFiles())
46
+
47
+ env.Alias("dist", sdist + bdist)
48
+ env.Alias("bdist", bdist)
49
+ env.Alias("sdist", sdist)
@@ -0,0 +1 @@
1
+ This directory is here for FORM package sources.
@@ -0,0 +1,29 @@
1
+ __all__ = ("form_command", "form")
2
+
3
+ import os
4
+
5
+ def _form_cmd() -> list[str]:
6
+ """
7
+ Determine the path and the needed set of arguments to call
8
+ the form binary. Make sure the include paths are set up so
9
+ that form packages installed into the Python environment are
10
+ found.
11
+ """
12
+ this_dir = os.path.abspath(os.path.dirname(__file__))
13
+ packages = os.path.join(os.path.dirname(this_dir), "form-packages")
14
+ if not packages.endswith(os.path.sep):
15
+ packages += os.path.sep
16
+ form_path = os.path.join(this_dir, "tform")
17
+ tmp_dir = os.environ.get("TMPDIR", "/tmp")
18
+ form_tmp = os.environ.get("FORMTMP", tmp_dir)
19
+ form_tmpsort = os.environ.get("FORMTMPSORT", tmp_dir)
20
+ return [form_path, "-I", packages, "-t", form_tmp, "-ts", form_tmpsort]
21
+
22
+ def form(*args: tuple[str]) -> None:
23
+ """Run the form binary with the given arguments."""
24
+ import subprocess
25
+ subprocess.check_call(form_command + list(args))
26
+
27
+ # This is the path and the needed set of arguments to call the
28
+ # form binary.
29
+ form_command: list[str] = _form_cmd()
@@ -0,0 +1,10 @@
1
+ from . import form_command
2
+ import os
3
+ import sys
4
+
5
+ def main() -> None:
6
+ os.execv(form_command[0], form_command + sys.argv[1:])
7
+ exit(11)
8
+
9
+ if __name__ == "__main__":
10
+ main()
@@ -0,0 +1,172 @@
1
+ CC=cc
2
+ CXX=c++
3
+ FETCH=wget --no-use-server-timestamps -qO
4
+
5
+ clean: phony
6
+ rm -rf bin/ build/ include/ lib/ share/ *.done
7
+
8
+ phony:;
9
+
10
+ DIR=${CURDIR}
11
+ DEP_CFLAGS=-I${DIR}/include -O3 -fno-omit-frame-pointer -fdata-sections -ffunction-sections ${CFLAGS}
12
+ DEP_FFLAGS=-I${DIR}/include -O3 ${FFLAGS}
13
+ DEP_LDFLAGS=-L${DIR}/lib -Wl,--gc-sections ${LDFLAGS}
14
+
15
+ MAKEOVERRIDES=
16
+
17
+ build/.dir:
18
+ mkdir -p bin build include lib share
19
+ date >$@
20
+
21
+ ## GMP
22
+
23
+ VER_gmp=6.3.0
24
+
25
+ build/gmp-${VER_gmp}.tar.xz: build/.dir
26
+ rm -f build/gmp*.tar.xz
27
+ ${FETCH} $@ \
28
+ "https://gmplib.org/download/gmp/gmp-${VER_gmp}.tar.xz" \
29
+ || rm -f $@
30
+
31
+ gmp.done: build/gmp-${VER_gmp}.tar.xz
32
+ rm -rf build/gmp-*/
33
+ cd build && tar xf gmp-${VER_gmp}.tar.xz
34
+ cd build/gmp-*/ && mv configfsf.guess config.guess
35
+ cd build/gmp-*/ && \
36
+ env CC="${CC}" CXX="${CXX}" CFLAGS="-std=c11 ${DEP_CFLAGS}" CXXFLAGS="${DEP_CFLAGS}" LDFLAGS="${DEP_LDFLAGS}" \
37
+ ./configure \
38
+ --prefix="${DIR}" --libdir="${DIR}/lib" \
39
+ --includedir="${DIR}/include" --bindir="${DIR}/bin" \
40
+ --enable-static --disable-shared --enable-cxx
41
+ +${MAKE} -C build/gmp-*/
42
+ +${MAKE} -C build/gmp-*/ install
43
+ date >$@
44
+
45
+ ## MPFR
46
+
47
+ VER_mpfr=4.2.2
48
+
49
+ build/mpfr-${VER_mpfr}.tar.xz: build/.dir
50
+ rm -f build/mpfr*.tar.xz
51
+ ${FETCH} $@ \
52
+ "https://www.mpfr.org/mpfr-${VER_mpfr}/mpfr-${VER_mpfr}.tar.xz" \
53
+ || rm -f $@
54
+
55
+ mpfr.done: build/mpfr-${VER_mpfr}.tar.xz gmp.done
56
+ rm -rf build/mpfr-*/
57
+ cd build && tar xf mpfr-${VER_mpfr}.tar.xz
58
+ cd build/mpfr-*/ && \
59
+ env CC="${CC}" CXX="${CXX}" CFLAGS="${DEP_CFLAGS}" CXXFLAGS="${DEP_CFLAGS}" LDFLAGS="${DEP_LDFLAGS}" \
60
+ ./configure \
61
+ --prefix="${DIR}" --libdir="${DIR}/lib" \
62
+ --includedir="${DIR}/include" --bindir="${DIR}/bin" \
63
+ --enable-static --disable-shared --enable-thread-safe \
64
+ --with-gmp="${DIR}"
65
+ +${MAKE} -C build/mpfr-*/
66
+ +${MAKE} -C build/mpfr-*/ install
67
+ date >$@
68
+
69
+ ## Flint
70
+
71
+ VER_flint=3.5.0
72
+
73
+ build/flint-${VER_flint}.tar.gz: build/.dir
74
+ rm -f build/flint*.tar.gz
75
+ ${FETCH} $@ \
76
+ "https://flintlib.org/download/flint-${VER_flint}.tar.gz" \
77
+ || rm -f $@
78
+
79
+ flint.done: build/flint-${VER_flint}.tar.gz gmp.done mpfr.done
80
+ rm -rf build/flint-*/
81
+ cd build && tar xf flint-${VER_flint}.tar.gz
82
+ cd build/flint-*/ && mv config/configfsf.guess config/config.guess
83
+ cd build/flint-*/ && \
84
+ ./configure \
85
+ --prefix="${DIR}" --enable-static --disable-shared \
86
+ CC="${CC}" CXX="${CXX}" CFLAGS="${DEP_CFLAGS} -Wno-deprecated-declarations -Wmissing-prototypes -Wno-stringop-overflow -Wno-stringop-overread -Werror=implicit-function-declaration -Wall -std=c11 -pedantic -O3" \
87
+ --with-gmp="${DIR}" \
88
+ --with-mpfr="${DIR}"
89
+ +${MAKE} -C build/flint-*/ V=1
90
+ +${MAKE} -C build/flint-*/ install
91
+ date >$@
92
+
93
+
94
+ ## zlib
95
+
96
+ VER_zlib=1.3.2
97
+
98
+ build/zlib-${VER_zlib}.tar.xz: build/.dir
99
+ rm -f build/zlib*.tar.xz
100
+ ${FETCH} $@ \
101
+ "http://zlib.net/fossils/zlib-${VER_zlib}.tar.gz" \
102
+ || rm -f $@
103
+
104
+ zlib.done: build/zlib-${VER_zlib}.tar.xz
105
+ rm -rf build/zlib-*/
106
+ cd build && tar xf zlib-${VER_zlib}.tar.xz
107
+ cd build/zlib-*/ && \
108
+ env CC="${CC}" CXX="${CXX}" CFLAGS="${DEP_CFLAGS}" \
109
+ ./configure \
110
+ --prefix="${DIR}" --static
111
+ +${MAKE} -C build/zlib-*/
112
+ +${MAKE} -C build/zlib-*/ install
113
+ date >$@
114
+
115
+ ## FORM
116
+
117
+ VER_form=5.0.0
118
+
119
+ build/form-${VER_form}.tar.gz: build/.dir
120
+ rm -f build/form*.tar.gz
121
+ ${FETCH} $@ \
122
+ "https://github.com/form-dev/form/releases/download/v${VER_form}/form-${VER_form}.tar.gz" \
123
+ || rm -f $@
124
+
125
+ form.done: build/form-${VER_form}.tar.gz flint.done gmp.done mpfr.done zlib.done zstd.done
126
+ rm -rf build/form-*/
127
+ cd build && tar xf form-${VER_form}.tar.gz
128
+ cd build/form-*/ && \
129
+ env CC="${CC}" CXX="${CXX}" CFLAGS="${DEP_CFLAGS} -g" CXXFLAGS="${DEP_CFLAGS} -g" LDFLAGS="${DEP_LDFLAGS}" \
130
+ ./configure \
131
+ --prefix="${DIR}" --libdir="${DIR}/lib" \
132
+ --includedir="${DIR}/include" --bindir="${DIR}/bin" \
133
+ --enable-scalar=yes \
134
+ --enable-threaded=yes \
135
+ --enable-debug=yes \
136
+ --enable-parform=no \
137
+ --enable-float=yes \
138
+ --enable-static-link=no \
139
+ --enable-native=no \
140
+ --with-flint="${DIR}" \
141
+ --with-gmp="${DIR}" \
142
+ --with-mpfr="${DIR}" \
143
+ --with-zlib="${DIR}" \
144
+ --with-zstd="${DIR}"
145
+ +${MAKE} -C build/form-*/
146
+ +${MAKE} -C build/form-*/ install
147
+ date >$@
148
+
149
+ ## Zstd
150
+
151
+ VER_zstd=1.5.7
152
+
153
+ build/zstd-${VER_zstd}.tar.gz: build/.dir
154
+ rm -f build/zstd*.tar.gz
155
+ ${FETCH} $@ \
156
+ "https://github.com/facebook/zstd/releases/download/v${VER_zstd}/zstd-${VER_zstd}.tar.gz" \
157
+ || rm -f $@
158
+
159
+ zstd.done: build/zstd-${VER_zstd}.tar.gz zlib.done
160
+ rm -rf build/zstd-*/
161
+ cd build && tar xf zstd-${VER_zstd}.tar.gz
162
+ @# build libzstd.a, libastd_zlibwrapper.a, and zstd
163
+ +${MAKE} -C build/zstd-*/lib/ CC=${CC} CXX=${CXX} CFLAGS="${DEP_CFLAGS}" LDFLAGS="${DEP_LDFLAGS}" VERBOSE=1 libzstd.a-release-nomt
164
+ +${MAKE} -C build/zstd-*/programs/ CC=${CC} CXX=${CXX} CFLAGS="${DEP_CFLAGS}" LDFLAGS="${DEP_LDFLAGS}" VERBOSE=1 HAVE_ZLIB=no HAVE_LZMA=no HAVE_LZ4=no zstd-nomt
165
+ +${MAKE} -C build/zstd-*/zlibWrapper/ CC=${CC} CXX=${CXX} CFLAGS="${DEP_CFLAGS} -DZWRAP_USE_ZSTD=1" LDFLAGS="${DEP_LDFLAGS}" VERBOSE=1 zstd_zlibwrapper.o gzclose.o gzlib.o gzread.o gzwrite.o
166
+ cd build/zstd-*/zlibWrapper/ && ${AR} rcs libzstd_zlibwrapper.a zstd_zlibwrapper.o gzclose.o gzlib.o gzread.o gzwrite.o
167
+ @# install libzstd.a, libastd_zlibwrapper.a, zstd*.h, and zstd
168
+ +${MAKE} -C build/zstd-*/lib/ PREFIX="${DIR}" VERBOSE=1 install-static install-includes
169
+ +${MAKE} -C build/zstd-*/programs/ PREFIX="${DIR}" VERBOSE=1 install
170
+ cd build/zstd-*/zlibWrapper/ && cp -a libzstd_zlibwrapper.a "${DIR}/lib/"
171
+ cd build/zstd-*/zlibWrapper/ && cp -a zstd_zlibwrapper.h "${DIR}/include/"
172
+ date >$@
@@ -0,0 +1,23 @@
1
+ [project]
2
+ name = "form-bin"
3
+ version = "5.0.0a4"
4
+ description = "The FORM project for symbolic manipulation of very big expressions"
5
+ readme = "README.md"
6
+ license = "GPL-3.0-or-later"
7
+ requires-python = ">=3.10"
8
+
9
+ [project.urls]
10
+ homepage = "https://www.nikhef.nl/~form"
11
+ source = "https://github.com/form-dev/form"
12
+ documentation = "https://form-dev.github.io/form-docs/stable/manual/"
13
+ issues = "https://github.com/form-dev/form/issues"
14
+ wiki = "https://github.com/form-dev/form/wiki"
15
+ discussions = "https://github.com/form-dev/form/discussions"
16
+
17
+ [build-system]
18
+ requires = ["enscons~=0.30", "toml~=0.10", "packaging>=20.9"]
19
+ build-backend = "enscons.api"
20
+
21
+ [project.scripts]
22
+ "form" = "form_bin.__main__:main"
23
+ "form-bin" = "form_bin.__main__:main"