{ "info": { "author": "Hexcell", "author_email": "fabian0010k@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# HXMK (Hexcell Make)\n![PyPI](https://img.shields.io/pypi/v/HXMK.svg) ![GitHub](https://img.shields.io/github/license/Hexcell/HXMK.svg) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/HXMK.svg)\n\nHXMK is a python-based build system for the Hexcell Projects. It brings a Makefile like experience to a familiar and simple environment.\n\nBest of all: it has nice colors\n\n![colors2](https://raw.githubusercontent.com/Hexcell/HXMK/master/screenshots/colors2.png)\n![colors](https://raw.githubusercontent.com/Hexcell/HXMK/master/screenshots/colors.png)\n\n### Installation\n```shell\npip install HXMK\n```\n\nDependencies:\n- [colorama](https://pypi.org/project/colorama/) >= 0.4.1\n\n##### Manual (latest version)\n```shell\n$ git clone https://github.com/Hexcell/HXMK.git\n$ cd HXMK\n\n$ pip install .\n```\n\n### Usage\nIf the project directory contains a `hxmk.py` file, you can do\n```shell\nhxmk [args|rules]\n```\nArguments are specified like `name=value` and rules like `name`.\n```shell\nhxmk abc=123 somerule\n```\n\nIn case no rule was given, HXMK will look for the rule `@everything` and execute it (if it exists).\nNo arguments or rules have to be specified be default.\n```shell\nhxmk # <- this is completely valid\n```\n\nHXMK can also be used to clean directories.\n```shell\nhxmk clean [args|rules]\n```\nThis will look for a `.clean` file that contains a [glob](https://docs.python.org/3/library/glob.html#glob.glob) pattern on each line.\n\nExample of a `.clean` file:\n```shell\nbin\nobj\n*.o\n__pycache__\n```\n\n`clean` counts as a rule (although it's not an actual rule), so the rule `@everything` will not be run if not explicitly stated like this:\n```shell\nhxmk clean everything # will clean and THEN run @everything\n```\n\n### `hxmk.py`\n##### Rules\nThe simplest rule would look something like this:\n```py\n@rule()\ndef everything(c):\n pass\n```\n`c` is an instance of the class `Commander`, it is used to execute commands. To do so, it overloads the lshift operator.\n```py\n@rule()\ndef everything(c):\n c << \"echo Commands are executed like this.\"\n```\nRules can have dependencies. They are given through the return annotation. A rules dependencies are executed before it.\n```py\n@rule()\ndef everything(c) -> \"other\":\n c << \"echo What a lovely day it is today.\"\n\ndef other(c):\n c << \"echo @everything depends on me so I go first!\"\n```\nMultiple dependencies are given in a list or tuple, whichever you prefer.\n```py\n@rule()\ndef everything(c) -> (\"other\", \"something\")\n```\n\nRules have triggers, which are state if and when a rule shall be executed. If no trigger is specified, the trigger `always` will be set to `True`.\n\nFor example, to execute a rule whenever at least one of the folders `bin` and `obj` are missing, you could do the following:\n```py\n@rule(not_found=[\"bin\", \"obj\"])\ndef dirs(c):\n c << \"mkdir -p bin\"\n c << \"mkdir -p obj\"\n```\nThe following triggers are implemented so far:\n - `always`, always execute the rule. It is a bool.\n - `dependencies`, execute it if one or more dependencies were executed. It is a bool.\n - `not_found`, execute when a specified path is not found (file or folder). It can be a `str`, `list` or a `tuple`.\n - `changed`, cache a file or list of files. Execute when any of the specified files are not found in the cache or have been changed. It can be a `str`, `list`, or a `tuple`.\n\nIf `not_found` is given, the rule will assume that you are going to create the specified path. If that path is not found after the rule was executed, a warning will be shown.\n\nAn example of a caching rule:\n```py\n@rule(changed=[\"a.cpp\", \"b.cpp\"], not_found=\"program\")\n```\n\nThis above rule will be executed if `a.cpp` or `b.cpp` have been changed, or when `program` was not found.\nThough for this particular case, pattern rules would be recommended.\n\n##### Pattern Rules\nPattern Rules are rules that are executed multiple times for multiple files.\nThey look like this:\n```py\n@pattern(\"src/*.c -> obj/*.o\")\ndef somerule(c, src, dest):\n pass\n```\n(The syntax for the patterns is `src -> dest`.)\nThis basically means, every `.c` file in `src` will be turned into an `.o` file in `obj`.\nThe Pattern Rule will be executed for every `.c` file.\nThis could be used to compile every `.c` file in a directory.\n```py\n@pattern(\"src/*.c -> obj/*.o\")\ndef somerule(c, src, dest):\n c << f\"gcc -c {src} -o {dest}\"\n```\nPattern Rules can have multiple sources and destinations. In that case, the parameters `src` and `dest` are lists.\n```py\n@pattern(\"src/*.c include/*.h -> obj/*.o\")\ndef somerule(c, src, dest):\n c << f\"gcc -c {src[0]} -o {dest}\"\n```\n\nPattern rules are cached.\nBefore executing, the Pattern Rule checks whether the source files have been modified since the last build and if the destination file exists already. If the destination file does not exist, the rule will be executed, else it will only be executed if the source file was modified or not found in the cache.\n\n#### Builtins\nAll builtins are immediately available without having to import anything.\n\n##### make\n```py\nmake(self, path, args=[], isolate=False)\n```\n`make` will start HXMK in a different folder. Optionally args (in the sense of CLI args) can be passed in to `args`.\n\nBy default all variables from the root module are readable in every module called by `make`. This behavior can be stopped by setting `isolate` to `True`.\n\n```py\n# hxmk.py\nsomevar = \"hello\"\n@rule()\ndef everything(c):\n make(\"other\")\n```\n```py\n# other/hxmk.py\n@rule()\ndef everything(c):\n print(somevar)\n```\n```shell\n>>> @all\n>>> Entering other\n>>> other/@all\n>>> \"hello\"\n```\n\n##### default\n```py\ndefault(arg, val)\n```\n`default` is used to optain a value from the CLI or default to another value in case it's not found. The first argument is the name and the second one is the default value.\nAn example would be:\n```shell\n$ hxmk config=debug\n```\n```py\nconfig = default(\"config\", \"release\")\nassert config in [\"debug\", \"release\"]\n\n# ...now config can be used\n```\n\n##### as_args\n```py\nas_args(l, prefix=\"\", suffix=\"\")\n```\n`as_args` is used to use a list as CLI arguments. The first argument is a list, tuple or dict, the keyword arguments are `prefix` and `suffix`.\n\nAn example use case would be this:\n```py\n...\n c << \"ld ... %s\" % as_args([\"a.o\", \"b.o\", \"c.o\"])\n\n>>> ld ... \"a.o\" \"b.o\" \"c.o\"\n```\nPassing in a dict would return `\"key=value\"` for each item.\n```py\n...\n c << \"ld ... %s\" % as_args({\"a\": \"b\", \"c\": \"d\"})\n\n>>> ld ... \"a=b\" \"c=d\"\n```\nWhen passing in a dict, the prefix and suffix parameters can not be used.\n\n##### glob\n```\nglob(pathname, *, recursive=False)\n```\n`glob` is just the glob function from pythons standard library. For more information, look at [Pythons documentation on it](https://docs.python.org/3/library/glob.html#glob.glob).\n\nIt could be used in combination with `as_args` to link all object files.\n```py\n...\n c << \"ld ... %s\" % as_args(glob(\"obj/*.o\"))\n\n>>> ld ... \"main.o\" \"utils.o\"\n```\n\n### Goals\nThe main goal is to create a simple build too with the same functionality as make (+ more) while maintaining readability and sanity.\n\nCurrently, HXMK runs just fine, but there have been and will most likely be many API changes. Bugs are to be expected, if you find one, do not hesitate to create an issue.\n\n#### TODO\n - [x] rules\n - [x] pattern eules\n - [x] argument parsing\n - [x] build subdirectories\n - [x] cleaning\n - [ ] add docstrings and comments for every function\n - [ ] full api documentation\n - [ ] better cross-platform support / more builtins (mkdir, ...)\n - [ ] in depth compatibility testing with various python versions\n\n### Contributing\nAny form of contribution is welcome ^^\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Hexcell/HXMK.git", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "HXMK", "package_url": "https://pypi.org/project/HXMK/", "platform": "", "project_url": "https://pypi.org/project/HXMK/", "project_urls": { "Homepage": "https://github.com/Hexcell/HXMK.git" }, "release_url": "https://pypi.org/project/HXMK/0.0.9/", "requires_dist": [ "colorama (>=0.4.1)" ], "requires_python": "", "summary": "A Python-based build system with a Makefile-like experience", "version": "0.0.9" }, "last_serial": 5030341, "releases": { "0.0.3": [ { "comment_text": "", "digests": { "md5": "8a2ea48bc9f0829821cfe64891f89e6b", "sha256": "11ce034cc12a31620d24abe9fbf1da3019e5886c2f675727babb4e5246ca05f8" }, "downloads": -1, "filename": "HXMK-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "8a2ea48bc9f0829821cfe64891f89e6b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 15634, "upload_time": "2019-03-05T19:16:41", "url": "https://files.pythonhosted.org/packages/66/9b/6e2182c5a75d876ab533a86227ab0c188170958db7afdd95ef6aa7b5aab8/HXMK-0.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c41fcc241baf3d18221fac9f3856f204", "sha256": "da6c2df6da59a2f91a3c1771f85efa210c1d9e61c48d97d3d31264cab695eca1" }, "downloads": -1, "filename": "HXMK-0.0.3.tar.gz", "has_sig": false, "md5_digest": "c41fcc241baf3d18221fac9f3856f204", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9407, "upload_time": "2019-03-05T19:16:43", "url": "https://files.pythonhosted.org/packages/09/94/0e793f383af61a36be61efe8c77388df31926d4f4fbdcb1b9bdc1bebc3da/HXMK-0.0.3.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "c438aa0e6331522c819d534c6f868f21", "sha256": "63e0e5c200c5f6d2c8618484074cb9b90aa0ea194a7215cc508197c3a4a029f7" }, "downloads": -1, "filename": "HXMK-0.0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "c438aa0e6331522c819d534c6f868f21", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11030, "upload_time": "2019-03-11T18:12:29", "url": "https://files.pythonhosted.org/packages/31/a4/a6a1b108de74c2437ff6aafadad536f004761839d1233882e4843969a3e6/HXMK-0.0.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "619d37df3790775bfeb1e3836bfc4c82", "sha256": "f7682f0bc2117af8845f17af3376bdb3bde319f8daacb3718479c6252eda2731" }, "downloads": -1, "filename": "HXMK-0.0.5.tar.gz", "has_sig": false, "md5_digest": "619d37df3790775bfeb1e3836bfc4c82", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9392, "upload_time": "2019-03-11T18:12:30", "url": "https://files.pythonhosted.org/packages/07/33/d73e0edca72a9d125bf58c380ba2439a46518e5cbe67b67227e5dc935d9b/HXMK-0.0.5.tar.gz" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "3e64d027ea58403406348e651a5e721e", "sha256": "f668bc09033a25f3b09c933455894279b22156714320e54226e1fef0282a0e0d" }, "downloads": -1, "filename": "HXMK-0.0.6-py3-none-any.whl", "has_sig": false, "md5_digest": "3e64d027ea58403406348e651a5e721e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11249, "upload_time": "2019-03-15T21:01:05", "url": "https://files.pythonhosted.org/packages/59/8f/ea3ee3d4162a0cece6ec627381fc37766b1fde232d7e411e936f9a3c7bcc/HXMK-0.0.6-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2716ade8d527a6b609afcc70d69eb875", "sha256": "a9800daa07020fce4dd570e8a82c45ec3531a06b53e56f452854f1b4fec40834" }, "downloads": -1, "filename": "HXMK-0.0.6.tar.gz", "has_sig": false, "md5_digest": "2716ade8d527a6b609afcc70d69eb875", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9623, "upload_time": "2019-03-15T21:01:06", "url": "https://files.pythonhosted.org/packages/fa/13/8f9af19e9116cfdb3c714a21f007360eba4ef5f8aabf6db818ffd13bc44b/HXMK-0.0.6.tar.gz" } ], "0.0.6.post1": [ { "comment_text": "", "digests": { "md5": "32cd2a2484593d54138b97929702434f", "sha256": "4ba0ca26e542580f12e8908087a706cc967cf18dc5ae7b35481e7a3026c5e314" }, "downloads": -1, "filename": "HXMK-0.0.6.post1-py3-none-any.whl", "has_sig": false, "md5_digest": "32cd2a2484593d54138b97929702434f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11221, "upload_time": "2019-03-15T21:30:26", "url": "https://files.pythonhosted.org/packages/98/fe/8c8716502797ebe6095271929aecb0900b2fd61972f05eb31a27d7f1655d/HXMK-0.0.6.post1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7ba6c638e71c9b694343e690922867ba", "sha256": "c3c77dbe7dd67d98feffaf01bf33e03cf3dd890381308134108ad07473d7ef5d" }, "downloads": -1, "filename": "HXMK-0.0.6.post1.tar.gz", "has_sig": false, "md5_digest": "7ba6c638e71c9b694343e690922867ba", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9544, "upload_time": "2019-03-15T21:30:28", "url": "https://files.pythonhosted.org/packages/82/38/87fb72f394b5e6477a31de79cc60726fd280a2c7fce8c1677c10228be0ef/HXMK-0.0.6.post1.tar.gz" } ], "0.0.6.post2": [ { "comment_text": "", "digests": { "md5": "bca90dc99d933209117db6c4c5e4a395", "sha256": "72d625a528bdd65084718c391ec7bf8d882d0518f131ed1268e5556bec9f2436" }, "downloads": -1, "filename": "HXMK-0.0.6.post2-py3-none-any.whl", "has_sig": false, "md5_digest": "bca90dc99d933209117db6c4c5e4a395", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11232, "upload_time": "2019-03-15T21:40:00", "url": "https://files.pythonhosted.org/packages/b7/7a/0e4985c1d2021e5161649ea346d603f1c6ed192fc4073048a4ebe35bb037/HXMK-0.0.6.post2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "67be148d2ec778b66b961f93e15bbf49", "sha256": "91c2a0f7a55249d5b888209e70b70311698fc48be245dc93572ef52b07a61992" }, "downloads": -1, "filename": "HXMK-0.0.6.post2.tar.gz", "has_sig": false, "md5_digest": "67be148d2ec778b66b961f93e15bbf49", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9565, "upload_time": "2019-03-15T21:40:01", "url": "https://files.pythonhosted.org/packages/07/a0/c5a897a264cd097082a8331127661633456294b881304337a9e75687f752/HXMK-0.0.6.post2.tar.gz" } ], "0.0.7": [ { "comment_text": "", "digests": { "md5": "c095f1b106f0ecfacee239d6e4f57315", "sha256": "a147cac6d350e01079d41e2fb447eb771dc0dd78f9b479c4408e4640b34cc827" }, "downloads": -1, "filename": "HXMK-0.0.7-py3-none-any.whl", "has_sig": false, "md5_digest": "c095f1b106f0ecfacee239d6e4f57315", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11163, "upload_time": "2019-03-18T20:36:19", "url": "https://files.pythonhosted.org/packages/7e/79/b258b4c345f1b0a96c48d96351e1a160d1f3660c3b50a84a756e7aa7a1b3/HXMK-0.0.7-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f4f58e693cd6abb6a776231ea36602e0", "sha256": "5eff3882ad11cbdff6338e8d3c06d896d69b187ce7724a9d4d26209283968939" }, "downloads": -1, "filename": "HXMK-0.0.7.tar.gz", "has_sig": false, "md5_digest": "f4f58e693cd6abb6a776231ea36602e0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9564, "upload_time": "2019-03-18T20:36:20", "url": "https://files.pythonhosted.org/packages/a5/5a/7a326e4289c777bdf4e928866ef16e792f742a0765b53cc33054559ec2de/HXMK-0.0.7.tar.gz" } ], "0.0.8": [ { "comment_text": "", "digests": { "md5": "a37c4fb8b3605a16be5a081cf62a1446", "sha256": "9be50a218817d1bb23882951eb43098897a18dc2b2fe38f03a6c67914a746af6" }, "downloads": -1, "filename": "HXMK-0.0.8-py3-none-any.whl", "has_sig": false, "md5_digest": "a37c4fb8b3605a16be5a081cf62a1446", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11193, "upload_time": "2019-03-27T20:01:33", "url": "https://files.pythonhosted.org/packages/d4/86/44ca9e54786c7e769fe3885a47fb345b52920c9dcb64b433af143d05e6c7/HXMK-0.0.8-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2681406c724f8ceb9a6025e33d9e24dd", "sha256": "49720ce65bfdf0d1b98b82b0557780a6e6456a5668c9c7fd12d362821ed35cbb" }, "downloads": -1, "filename": "HXMK-0.0.8.tar.gz", "has_sig": false, "md5_digest": "2681406c724f8ceb9a6025e33d9e24dd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9681, "upload_time": "2019-03-27T20:01:34", "url": "https://files.pythonhosted.org/packages/6f/7d/273e1a96ec72f0243de0b00f0ce2d2d2b5883ef712de0aa941063e80e4f1/HXMK-0.0.8.tar.gz" } ], "0.0.9": [ { "comment_text": "", "digests": { "md5": "de966369851ce5b4d30fd5eb22e4140e", "sha256": "147e850a2e8d1b6157d590553a4ec1d8146fb486c77a0046a31209db6464e35b" }, "downloads": -1, "filename": "HXMK-0.0.9-py3-none-any.whl", "has_sig": false, "md5_digest": "de966369851ce5b4d30fd5eb22e4140e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11211, "upload_time": "2019-04-01T16:11:22", "url": "https://files.pythonhosted.org/packages/05/1f/076fa6f63a042bb8f5c24d88c485d0a4dc030d7ba9b7029ea1b20c2de2aa/HXMK-0.0.9-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "176cff145b732ff7ef063a7a9df662a1", "sha256": "8169967caffe50bda0ecedcbc7ea665aac234e7d0afc637f4466fa3cb79cc8c9" }, "downloads": -1, "filename": "HXMK-0.0.9.tar.gz", "has_sig": false, "md5_digest": "176cff145b732ff7ef063a7a9df662a1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9711, "upload_time": "2019-04-01T16:11:24", "url": "https://files.pythonhosted.org/packages/42/b3/492761d67751058cb9eb629d7eea7aa3acce51bfda19560d2d024490b8b1/HXMK-0.0.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "de966369851ce5b4d30fd5eb22e4140e", "sha256": "147e850a2e8d1b6157d590553a4ec1d8146fb486c77a0046a31209db6464e35b" }, "downloads": -1, "filename": "HXMK-0.0.9-py3-none-any.whl", "has_sig": false, "md5_digest": "de966369851ce5b4d30fd5eb22e4140e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11211, "upload_time": "2019-04-01T16:11:22", "url": "https://files.pythonhosted.org/packages/05/1f/076fa6f63a042bb8f5c24d88c485d0a4dc030d7ba9b7029ea1b20c2de2aa/HXMK-0.0.9-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "176cff145b732ff7ef063a7a9df662a1", "sha256": "8169967caffe50bda0ecedcbc7ea665aac234e7d0afc637f4466fa3cb79cc8c9" }, "downloads": -1, "filename": "HXMK-0.0.9.tar.gz", "has_sig": false, "md5_digest": "176cff145b732ff7ef063a7a9df662a1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9711, "upload_time": "2019-04-01T16:11:24", "url": "https://files.pythonhosted.org/packages/42/b3/492761d67751058cb9eb629d7eea7aa3acce51bfda19560d2d024490b8b1/HXMK-0.0.9.tar.gz" } ] }