jam-build 0.6.0__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.
Files changed (78) hide show
  1. jam_build-0.6.0/.github/workflows/pypi.yml +87 -0
  2. jam_build-0.6.0/.github/workflows/python-package.yml +39 -0
  3. jam_build-0.6.0/.gitignore +12 -0
  4. jam_build-0.6.0/LICENSE +21 -0
  5. jam_build-0.6.0/PKG-INFO +117 -0
  6. jam_build-0.6.0/README.md +100 -0
  7. jam_build-0.6.0/conftest.py +23 -0
  8. jam_build-0.6.0/docs/Jam.html +1329 -0
  9. jam_build-0.6.0/docs/Jam.md +484 -0
  10. jam_build-0.6.0/docs/Jambase.md +532 -0
  11. jam_build-0.6.0/docs/Jamfile.md +891 -0
  12. jam_build-0.6.0/pyproject.toml +36 -0
  13. jam_build-0.6.0/pytest.ini +2 -0
  14. jam_build-0.6.0/src/jamp/Jambase +2905 -0
  15. jam_build-0.6.0/src/jamp/Jamfile +2 -0
  16. jam_build-0.6.0/src/jamp/__init__.py +2 -0
  17. jam_build-0.6.0/src/jamp/__main__.py +4 -0
  18. jam_build-0.6.0/src/jamp/build.py +305 -0
  19. jam_build-0.6.0/src/jamp/classes.py +943 -0
  20. jam_build-0.6.0/src/jamp/compile.py +109 -0
  21. jam_build-0.6.0/src/jamp/executors.py +506 -0
  22. jam_build-0.6.0/src/jamp/expand.py +352 -0
  23. jam_build-0.6.0/src/jamp/headers.py +249 -0
  24. jam_build-0.6.0/src/jamp/jam_builtins.py +357 -0
  25. jam_build-0.6.0/src/jamp/jam_lexer.py +255 -0
  26. jam_build-0.6.0/src/jamp/jam_syntax.py +506 -0
  27. jam_build-0.6.0/src/jamp/ninja_syntax.py +241 -0
  28. jam_build-0.6.0/src/jamp/paths.py +335 -0
  29. jam_build-0.6.0/src/jamp/pattern.py +115 -0
  30. jam_build-0.6.0/src/jamp/yacc.py +2482 -0
  31. jam_build-0.6.0/tests/__init__.py +0 -0
  32. jam_build-0.6.0/tests/data/include_test.jam +4 -0
  33. jam_build-0.6.0/tests/test_circular_inc/.gitignore +2 -0
  34. jam_build-0.6.0/tests/test_circular_inc/Jamfile +5 -0
  35. jam_build-0.6.0/tests/test_circular_inc/main.c +6 -0
  36. jam_build-0.6.0/tests/test_circular_inc/main.h +4 -0
  37. jam_build-0.6.0/tests/test_circular_inc/second.h +4 -0
  38. jam_build-0.6.0/tests/test_circular_inc/third.h +4 -0
  39. jam_build-0.6.0/tests/test_compile.py +724 -0
  40. jam_build-0.6.0/tests/test_copy_files/.gitignore +1 -0
  41. jam_build-0.6.0/tests/test_copy_files/Jamfile +1 -0
  42. jam_build-0.6.0/tests/test_copy_files/source/foo.so +0 -0
  43. jam_build-0.6.0/tests/test_dirs/.gitignore +3 -0
  44. jam_build-0.6.0/tests/test_dirs/Jamfile +17 -0
  45. jam_build-0.6.0/tests/test_dirs/one.c +0 -0
  46. jam_build-0.6.0/tests/test_dirs/sub2/empty +0 -0
  47. jam_build-0.6.0/tests/test_expand.py +236 -0
  48. jam_build-0.6.0/tests/test_glob.py +25 -0
  49. jam_build-0.6.0/tests/test_inner_calls/Jamfile +38 -0
  50. jam_build-0.6.0/tests/test_math_example/.gitignore +2 -0
  51. jam_build-0.6.0/tests/test_math_example/Jamfile +5 -0
  52. jam_build-0.6.0/tests/test_math_example/include/common.h +1 -0
  53. jam_build-0.6.0/tests/test_math_example/lib/print.c +8 -0
  54. jam_build-0.6.0/tests/test_math_example/src/main.c +12 -0
  55. jam_build-0.6.0/tests/test_multiline/.gitignore +1 -0
  56. jam_build-0.6.0/tests/test_multiline/Jamfile +21 -0
  57. jam_build-0.6.0/tests/test_multiline/in.txt +5 -0
  58. jam_build-0.6.0/tests/test_ninja.py +114 -0
  59. jam_build-0.6.0/tests/test_parse.py +278 -0
  60. jam_build-0.6.0/tests/test_simple/.gitignore +1 -0
  61. jam_build-0.6.0/tests/test_simple/Jamfile +16 -0
  62. jam_build-0.6.0/tests/test_simple/test.h +0 -0
  63. jam_build-0.6.0/tests/test_simple_app/.gitignore +2 -0
  64. jam_build-0.6.0/tests/test_simple_app/Jamfile +6 -0
  65. jam_build-0.6.0/tests/test_simple_app/main.c +9 -0
  66. jam_build-0.6.0/tests/test_simple_app/print.c +8 -0
  67. jam_build-0.6.0/tests/test_simple_app/say.c +7 -0
  68. jam_build-0.6.0/tests/test_subgen/.gitignore +2 -0
  69. jam_build-0.6.0/tests/test_subgen/Jamfile +6 -0
  70. jam_build-0.6.0/tests/test_subgen/Jamrules +25 -0
  71. jam_build-0.6.0/tests/test_subgen/gen.py +28 -0
  72. jam_build-0.6.0/tests/test_subgen/main.c +4 -0
  73. jam_build-0.6.0/tests/test_subgen/sub1/.gitignore +2 -0
  74. jam_build-0.6.0/tests/test_subgen/sub1/Jamfile +6 -0
  75. jam_build-0.6.0/tests/test_subgen/sub1/one.c +5 -0
  76. jam_build-0.6.0/tests/test_subgen/sub1/test.gen +9 -0
  77. jam_build-0.6.0/tests/test_subgen/sub1/two.c +5 -0
  78. jam_build-0.6.0/tests/test_targets.py +82 -0
@@ -0,0 +1,87 @@
1
+ name: Publish Python 🐍 distribution 📦 to PyPI
2
+
3
+ on: push
4
+
5
+ jobs:
6
+ build:
7
+ name: Build distribution 📦
8
+ runs-on: ubuntu-latest
9
+
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+ with:
13
+ persist-credentials: false
14
+ - name: Set up Python
15
+ uses: actions/setup-python@v5
16
+ with:
17
+ python-version: "3.x"
18
+ - name: Install pypa/build
19
+ run: >-
20
+ python3 -m pip install build --user
21
+ - name: Build a binary wheel and a source tarball
22
+ run: python3 -m build
23
+ - name: Store the distribution packages
24
+ uses: actions/upload-artifact@v4
25
+ with:
26
+ name: python-package-distributions
27
+ path: dist/
28
+
29
+ publish-to-pypi:
30
+ name: >-
31
+ Publish Python 🐍 distribution 📦 to PyPI
32
+ if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
33
+ needs:
34
+ - build
35
+ runs-on: ubuntu-latest
36
+ environment:
37
+ name: pypi
38
+ url: https://pypi.org/p/jamp
39
+ permissions:
40
+ id-token: write # IMPORTANT: mandatory for trusted publishing
41
+
42
+ steps:
43
+ - name: Download all the dists
44
+ uses: actions/download-artifact@v4
45
+ with:
46
+ name: python-package-distributions
47
+ path: dist/
48
+ - name: Publish distribution 📦 to PyPI
49
+ uses: pypa/gh-action-pypi-publish@release/v1
50
+
51
+ github-release:
52
+ name: >-
53
+ Sign the Python 🐍 distribution 📦 with Sigstore
54
+ and upload them to GitHub Release
55
+ needs:
56
+ - publish-to-pypi
57
+ runs-on: ubuntu-latest
58
+
59
+ permissions:
60
+ contents: write # IMPORTANT: mandatory for making GitHub Releases
61
+ id-token: write # IMPORTANT: mandatory for sigstore
62
+
63
+ steps:
64
+ - name: Download all the dists
65
+ uses: actions/download-artifact@v4
66
+ with:
67
+ name: python-package-distributions
68
+ path: dist/
69
+ - name: Sign the dists with Sigstore
70
+ uses: sigstore/gh-action-sigstore-python@v3.0.0
71
+ with:
72
+ inputs: >-
73
+ ./dist/*.tar.gz
74
+ ./dist/*.whl
75
+ - name: Create GitHub Release
76
+ env:
77
+ GITHUB_TOKEN: ${{ github.token }}
78
+ run: >-
79
+ gh release create "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" --notes ""
80
+ - name: Upload artifact signatures to GitHub Release
81
+ env:
82
+ GITHUB_TOKEN: ${{ github.token }}
83
+ # Upload to GitHub Release using the `gh` CLI.
84
+ # `dist/` contains the built packages, and the
85
+ # sigstore-produced signatures and certificates.
86
+ run: >-
87
+ gh release upload "$GITHUB_REF_NAME" dist/** --repo "$GITHUB_REPOSITORY"
@@ -0,0 +1,39 @@
1
+ # This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2
+ # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3
+
4
+ name: Python package
5
+
6
+ on:
7
+ push:
8
+ branches: [ "main" ]
9
+ pull_request:
10
+ branches: [ "main" ]
11
+
12
+ jobs:
13
+ build:
14
+
15
+ runs-on: ubuntu-latest
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ python-version: ["3.10", "3.11", "3.12"]
20
+
21
+ steps:
22
+ - uses: actions/checkout@v4
23
+ - name: Set up Python ${{ matrix.python-version }}
24
+ uses: actions/setup-python@v3
25
+ with:
26
+ python-version: ${{ matrix.python-version }}
27
+ - name: Install dependencies
28
+ run: |
29
+ python -m pip install --upgrade pip
30
+ python -m pip install flake8 pytest networkx
31
+ - name: Lint with flake8
32
+ run: |
33
+ # stop the build if there are Python syntax errors or undefined names
34
+ flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
35
+ # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
36
+ flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --ignore=E203,C901,W503 --exclude='*src/jamp/yacc.py','*src/jamp/__init__.py'
37
+ - name: Test with pytest
38
+ run: |
39
+ pytest
@@ -0,0 +1,12 @@
1
+ __pycache__
2
+ /jamtests
3
+ /dist
4
+ tags
5
+ parser.out
6
+
7
+ .ninja_log
8
+ .ninja_deps
9
+ build.ninja
10
+ *.o
11
+ *.o.d
12
+ *.cache
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Ildus Kurbangaliev
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,117 @@
1
+ Metadata-Version: 2.4
2
+ Name: jam-build
3
+ Version: 0.6.0
4
+ Summary: Jam Build System (based on Python)
5
+ Project-URL: Homepage, https://github.com/ildus/jamp
6
+ Project-URL: Issues, https://github.com/ildus/jamp/issues
7
+ Author-email: Ildus Kurbangaliev <i.kurbangaliev@gmail.com>
8
+ License-File: LICENSE
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Programming Language :: Python :: 3
12
+ Requires-Python: >=3.10
13
+ Requires-Dist: networkx>=3
14
+ Provides-Extra: tests
15
+ Requires-Dist: pytest>=8.3.3; extra == 'tests'
16
+ Description-Content-Type: text/markdown
17
+
18
+ Jam build system on Python
19
+ --------------------------
20
+
21
+ This is a Python reimplementation of the Jam build system
22
+ ([link](https://swarm.workshop.perforce.com/projects/perforce_software-jam)).
23
+
24
+ Supported platforms: Linux (Unix), OpenVMS, Windows (WIP)
25
+
26
+ What is Jam
27
+ ------------
28
+
29
+ Jam is a build system (similar to meson, cmake, etc.). The key difference is that its core is
30
+ essentially an interpreter for its internal language, with all building functionality
31
+ written in this language.
32
+
33
+ The raw Jam language doesn't know how to build anything by itself, but it allows you to define rules
34
+ and dependencies which construct the actual command sequence to build
35
+ projects using a dependency tree.
36
+
37
+ Jam includes `Jambase`, which is a collection of generic rules to build C, C++ and
38
+ Fortran projects. It can be easily extended (or modified)
39
+ to support other types of projects.
40
+
41
+ Differences from the original Jam
42
+ -----------------------------
43
+
44
+ * Uses `ninja`, `samurai` or other `ninja`-compatible builders for
45
+ the actual building of executables.
46
+ * `mkdir` is a built-in command that collects all created directories to the `dirs` target.
47
+ * Built-in rules are case-insensitive (`Echo` and `ECHO` are the same).
48
+ * Regular expressions are Python-based.
49
+ * `Clean` actions are ignored in favor of `ninja -t clean`.
50
+
51
+ Quick Start
52
+ -----------
53
+
54
+ Install:
55
+
56
+ # Install jamp with the system pip
57
+ pip3 install git+https://github.com/ildus/jamp
58
+
59
+ # Using pypy3 provides approximately twice the performance
60
+ # pypy3 -m pip install git+https://github.com/ildus/jamp
61
+
62
+ # Install ninja using your package manager
63
+ dnf install ninja
64
+ # or pacman -Syu ninja
65
+ # etc.
66
+
67
+ Example project structure with a library and a main executable that uses math functions:
68
+
69
+ src
70
+ main.c
71
+ lib
72
+ print.c
73
+ include
74
+ common.h
75
+
76
+ Jamfile
77
+
78
+ Corresponding Jamfile:
79
+
80
+ HDRS = include ; # common includes, affects all sources
81
+ Library libprint : lib/print.c ; # on Unix this will create libprint.a
82
+ Main app : src/main.c ; # executable
83
+ LinkLibraries app : libprint ; # linking the executable with our library
84
+ LINKLIBS on app = -lm ; # system libraries
85
+
86
+ To build the executable, simply run:
87
+
88
+ jamp && ninja
89
+
90
+ For more complex examples, look at the `tests` directory. When dealing with subdirectories,
91
+ it's recommended to use the `SubDir` rule. Note that this example should work on Windows
92
+ and Linux (because of explicit paths), but will not work on VMS.
93
+
94
+ Contributing
95
+ -----------
96
+
97
+ git clone git@github.com:ildus/jamp.git
98
+
99
+ # To run without installing
100
+ export PYTHONPATH=$PYTHONPATH:<current_dir>/jamp/src
101
+ python3 -m jamp
102
+
103
+ # Testing changes
104
+ pip install pytest
105
+ cd <jamp root folder>
106
+ pytest
107
+
108
+ Documentation
109
+ -------------
110
+
111
+ See the `docs` directory.
112
+
113
+ OpenVMS Notes
114
+ ---------------
115
+
116
+ Use my `github.com/ildus/samurai` fork for compilation. It supports the additional '$^' escape
117
+ sequence for newlines, allowing you to add full scripts to `build.ninja`.
@@ -0,0 +1,100 @@
1
+ Jam build system on Python
2
+ --------------------------
3
+
4
+ This is a Python reimplementation of the Jam build system
5
+ ([link](https://swarm.workshop.perforce.com/projects/perforce_software-jam)).
6
+
7
+ Supported platforms: Linux (Unix), OpenVMS, Windows (WIP)
8
+
9
+ What is Jam
10
+ ------------
11
+
12
+ Jam is a build system (similar to meson, cmake, etc.). The key difference is that its core is
13
+ essentially an interpreter for its internal language, with all building functionality
14
+ written in this language.
15
+
16
+ The raw Jam language doesn't know how to build anything by itself, but it allows you to define rules
17
+ and dependencies which construct the actual command sequence to build
18
+ projects using a dependency tree.
19
+
20
+ Jam includes `Jambase`, which is a collection of generic rules to build C, C++ and
21
+ Fortran projects. It can be easily extended (or modified)
22
+ to support other types of projects.
23
+
24
+ Differences from the original Jam
25
+ -----------------------------
26
+
27
+ * Uses `ninja`, `samurai` or other `ninja`-compatible builders for
28
+ the actual building of executables.
29
+ * `mkdir` is a built-in command that collects all created directories to the `dirs` target.
30
+ * Built-in rules are case-insensitive (`Echo` and `ECHO` are the same).
31
+ * Regular expressions are Python-based.
32
+ * `Clean` actions are ignored in favor of `ninja -t clean`.
33
+
34
+ Quick Start
35
+ -----------
36
+
37
+ Install:
38
+
39
+ # Install jamp with the system pip
40
+ pip3 install git+https://github.com/ildus/jamp
41
+
42
+ # Using pypy3 provides approximately twice the performance
43
+ # pypy3 -m pip install git+https://github.com/ildus/jamp
44
+
45
+ # Install ninja using your package manager
46
+ dnf install ninja
47
+ # or pacman -Syu ninja
48
+ # etc.
49
+
50
+ Example project structure with a library and a main executable that uses math functions:
51
+
52
+ src
53
+ main.c
54
+ lib
55
+ print.c
56
+ include
57
+ common.h
58
+
59
+ Jamfile
60
+
61
+ Corresponding Jamfile:
62
+
63
+ HDRS = include ; # common includes, affects all sources
64
+ Library libprint : lib/print.c ; # on Unix this will create libprint.a
65
+ Main app : src/main.c ; # executable
66
+ LinkLibraries app : libprint ; # linking the executable with our library
67
+ LINKLIBS on app = -lm ; # system libraries
68
+
69
+ To build the executable, simply run:
70
+
71
+ jamp && ninja
72
+
73
+ For more complex examples, look at the `tests` directory. When dealing with subdirectories,
74
+ it's recommended to use the `SubDir` rule. Note that this example should work on Windows
75
+ and Linux (because of explicit paths), but will not work on VMS.
76
+
77
+ Contributing
78
+ -----------
79
+
80
+ git clone git@github.com:ildus/jamp.git
81
+
82
+ # To run without installing
83
+ export PYTHONPATH=$PYTHONPATH:<current_dir>/jamp/src
84
+ python3 -m jamp
85
+
86
+ # Testing changes
87
+ pip install pytest
88
+ cd <jamp root folder>
89
+ pytest
90
+
91
+ Documentation
92
+ -------------
93
+
94
+ See the `docs` directory.
95
+
96
+ OpenVMS Notes
97
+ ---------------
98
+
99
+ Use my `github.com/ildus/samurai` fork for compilation. It supports the additional '$^' escape
100
+ sequence for newlines, allowing you to add full scripts to `build.ninja`.
@@ -0,0 +1,23 @@
1
+ import pytest
2
+
3
+
4
+ def pytest_configure(config):
5
+ import sys
6
+
7
+ sys._called_from_test = True
8
+
9
+
10
+ def pytest_unconfigure(config):
11
+ import sys
12
+
13
+ if hasattr(sys, '_called_from_test'):
14
+ delattr(sys, '_called_from_test')
15
+
16
+
17
+ @pytest.fixture(autouse=True)
18
+ def run_around_tests():
19
+ from jamp.jam_builtins import Builtins
20
+
21
+ Builtins.clear_output()
22
+
23
+ yield