CPPinator


NameCPPinator JSON
Version 1.0.4 PyPI version JSON
download
home_pagehttps://github.com/Hardvan/CPPinator
SummaryCPPinator is a Python automation script designed for compiling and running multiple C++ files in a specified directory. It simplifies the process of handling multiple C++ programs and provides a clear and organized output for each program's execution along with the execution time for each program.
upload_time2024-02-19 11:51:54
maintainer
docs_urlNone
authorHardik Pawar
requires_python>=3.6
license
keywords c++ automation script compile run multiple programs cppinator
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # CPPinator

CPPinator is a Python automation script designed for compiling and running multiple C++ files in a specified directory. It simplifies the process of handling multiple C++ programs and provides a clear and organized output for each program's execution along with the execution time for each program.

## How it works

1. The script allows you to specify a directory path where your C++ source code files are located.

2. It changes the current working directory to the specified path.

3. CPPinator lists all the C++ source code files with the `.cpp` extension in the directory.

4. For each `.cpp` file found, it compiles the code using `g++` and runs the resulting executable.

5. The script captures and displays the output and any errors produced by each program.

6. Upon successful execution of all C++ files, it provides a summary message.

7. Finally, the compiled executable file (`a.exe`) is deleted to keep your directory clean.

## Usage

1. Ensure you have Python and a C++ compiler (e.g., g++) installed on your system.

2. Install the `CPPinator` package from PyPI using pip:

   ```bash
   pip install CPPinator
   ```

   OR

   Clone or download the `CPPinator.py` script to your local machine.

   ```bash
   git clone https://github.com/Hardvan/CPPinator
   cd CPPinator
   pip install .
   ```

3. Call the `compile_and_run_cpp_files` function from the `CPPinator` package with the directory path as an argument.

   ```python
   from CPPinator import compile_and_run_cpp_files

   compile_and_run_cpp_files("path/to/your/directory")
   ```

   View the `run.py` file for an example of how to use the `CPPinator` package.

## Example Output

Here's an example of the script's output when run with a list of C++ files in the `Basic Problems` directory.

Changing working directory...
Current working directory: F:\CPPinator\Basic Problems

List of .cpp files:

1. `count_digits.cpp`
2. `divisors.cpp`
3. `gcd.cpp`
4. `palindrome_number.cpp`
5. `prime.cpp`
6. `reverse_array.cpp`
7. `reverse_number.cpp`

Running .cpp files:

1. `count_digits.cpp` (1.07s)

   No. of digits in 123456789 is:  
   9  
   9  
   9  
   Expected: 9

2. `divisors.cpp` (1.14s)

   Divisors of 100 are:  
   1 100 2 50 4 25 5 20 10  
   Divisors of 100 are:  
   1 2 4 5 10 20 25 50 100  
   Expected: 1 2 4 5 10 20 25 50 100

3. `gcd.cpp` (1.16s)

   GCD of 12 and 15 is:  
   3  
   3  
   Expected: 3

4. `palindrome_number.cpp` (1.07s)

   12321 is palindrome: true  
   Expected: true

5. `prime.cpp` (1.11s)

   100 is not prime  
   100 is not prime  
   Expected: not prime

6. `reverse_array.cpp` (1.05s)

   Original array:  
   1 2 3 4 5  
   Reversed array using two pointers:  
   5 4 3 2 1  
   Reversed array using recursion:  
   5 4 3 2 1  
   Reversed array using temporary array:  
   5 4 3 2 1  
   Expected: 5 4 3 2 1

7. `reverse_number.cpp` (1.24s)

   Reverse of 123456789 is: 987654321  
   Expected: 987654321

✅ Ran all C++ files successfully. (7.84s)



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Hardvan/CPPinator",
    "name": "CPPinator",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "C++,automation,script,compile,run,multiple,programs,CPPinator",
    "author": "Hardik Pawar",
    "author_email": "hardikpawarh@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/d9/5c/430f6fd0a2b8bfcd30f43e891095711ed316b46914f8249b30f136d9b3fa/CPPinator-1.0.4.tar.gz",
    "platform": null,
    "description": "# CPPinator\r\n\r\nCPPinator is a Python automation script designed for compiling and running multiple C++ files in a specified directory. It simplifies the process of handling multiple C++ programs and provides a clear and organized output for each program's execution along with the execution time for each program.\r\n\r\n## How it works\r\n\r\n1. The script allows you to specify a directory path where your C++ source code files are located.\r\n\r\n2. It changes the current working directory to the specified path.\r\n\r\n3. CPPinator lists all the C++ source code files with the `.cpp` extension in the directory.\r\n\r\n4. For each `.cpp` file found, it compiles the code using `g++` and runs the resulting executable.\r\n\r\n5. The script captures and displays the output and any errors produced by each program.\r\n\r\n6. Upon successful execution of all C++ files, it provides a summary message.\r\n\r\n7. Finally, the compiled executable file (`a.exe`) is deleted to keep your directory clean.\r\n\r\n## Usage\r\n\r\n1. Ensure you have Python and a C++ compiler (e.g., g++) installed on your system.\r\n\r\n2. Install the `CPPinator` package from PyPI using pip:\r\n\r\n   ```bash\r\n   pip install CPPinator\r\n   ```\r\n\r\n   OR\r\n\r\n   Clone or download the `CPPinator.py` script to your local machine.\r\n\r\n   ```bash\r\n   git clone https://github.com/Hardvan/CPPinator\r\n   cd CPPinator\r\n   pip install .\r\n   ```\r\n\r\n3. Call the `compile_and_run_cpp_files` function from the `CPPinator` package with the directory path as an argument.\r\n\r\n   ```python\r\n   from CPPinator import compile_and_run_cpp_files\r\n\r\n   compile_and_run_cpp_files(\"path/to/your/directory\")\r\n   ```\r\n\r\n   View the `run.py` file for an example of how to use the `CPPinator` package.\r\n\r\n## Example Output\r\n\r\nHere's an example of the script's output when run with a list of C++ files in the `Basic Problems` directory.\r\n\r\nChanging working directory...\r\nCurrent working directory: F:\\CPPinator\\Basic Problems\r\n\r\nList of .cpp files:\r\n\r\n1. `count_digits.cpp`\r\n2. `divisors.cpp`\r\n3. `gcd.cpp`\r\n4. `palindrome_number.cpp`\r\n5. `prime.cpp`\r\n6. `reverse_array.cpp`\r\n7. `reverse_number.cpp`\r\n\r\nRunning .cpp files:\r\n\r\n1. `count_digits.cpp` (1.07s)\r\n\r\n   No. of digits in 123456789 is:  \r\n   9  \r\n   9  \r\n   9  \r\n   Expected: 9\r\n\r\n2. `divisors.cpp` (1.14s)\r\n\r\n   Divisors of 100 are:  \r\n   1 100 2 50 4 25 5 20 10  \r\n   Divisors of 100 are:  \r\n   1 2 4 5 10 20 25 50 100  \r\n   Expected: 1 2 4 5 10 20 25 50 100\r\n\r\n3. `gcd.cpp` (1.16s)\r\n\r\n   GCD of 12 and 15 is:  \r\n   3  \r\n   3  \r\n   Expected: 3\r\n\r\n4. `palindrome_number.cpp` (1.07s)\r\n\r\n   12321 is palindrome: true  \r\n   Expected: true\r\n\r\n5. `prime.cpp` (1.11s)\r\n\r\n   100 is not prime  \r\n   100 is not prime  \r\n   Expected: not prime\r\n\r\n6. `reverse_array.cpp` (1.05s)\r\n\r\n   Original array:  \r\n   1 2 3 4 5  \r\n   Reversed array using two pointers:  \r\n   5 4 3 2 1  \r\n   Reversed array using recursion:  \r\n   5 4 3 2 1  \r\n   Reversed array using temporary array:  \r\n   5 4 3 2 1  \r\n   Expected: 5 4 3 2 1\r\n\r\n7. `reverse_number.cpp` (1.24s)\r\n\r\n   Reverse of 123456789 is: 987654321  \r\n   Expected: 987654321\r\n\r\n\u00e2\u0153\u2026 Ran all C++ files successfully. (7.84s)\r\n\r\n\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "CPPinator is a Python automation script designed for compiling and running multiple C++ files in a specified directory. It simplifies the process of handling multiple C++ programs and provides a clear and organized output for each program's execution along with the execution time for each program.",
    "version": "1.0.4",
    "project_urls": {
        "Homepage": "https://github.com/Hardvan/CPPinator"
    },
    "split_keywords": [
        "c++",
        "automation",
        "script",
        "compile",
        "run",
        "multiple",
        "programs",
        "cppinator"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a15c66a21bff9e80197ae28ea5b34fd915697ea9967cbbc054a16c280c822428",
                "md5": "1b239f7f8bb0b7246e1bf1cdece9a0ed",
                "sha256": "4ed5dda8292249a6ef5342d6c5bc006c9e2c13e0660e9d7219117eccbd6cc732"
            },
            "downloads": -1,
            "filename": "CPPinator-1.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1b239f7f8bb0b7246e1bf1cdece9a0ed",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 5616,
            "upload_time": "2024-02-19T11:51:51",
            "upload_time_iso_8601": "2024-02-19T11:51:51.382957Z",
            "url": "https://files.pythonhosted.org/packages/a1/5c/66a21bff9e80197ae28ea5b34fd915697ea9967cbbc054a16c280c822428/CPPinator-1.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d95c430f6fd0a2b8bfcd30f43e891095711ed316b46914f8249b30f136d9b3fa",
                "md5": "588949e694d16ea4af574fb671d9a3c6",
                "sha256": "e82ad70a1631502dac463b86175370d6c2fbb38ed881c69f5cc7cfa6d46cd0dc"
            },
            "downloads": -1,
            "filename": "CPPinator-1.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "588949e694d16ea4af574fb671d9a3c6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 5062,
            "upload_time": "2024-02-19T11:51:54",
            "upload_time_iso_8601": "2024-02-19T11:51:54.476511Z",
            "url": "https://files.pythonhosted.org/packages/d9/5c/430f6fd0a2b8bfcd30f43e891095711ed316b46914f8249b30f136d9b3fa/CPPinator-1.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-19 11:51:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Hardvan",
    "github_project": "CPPinator",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "cppinator"
}
        
Elapsed time: 0.18440s