Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recover changes to build PyPI package #1276

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lochel
Copy link
Member

@lochel lochel commented Nov 29, 2023

This recoveres some changes to create a PyPI package for OMSimulator, but I'm uncertain about the current state of the changes. I would appreciate insights from @mahge on the best approach before proceeding further.

To generate the PyPI package, follow these steps:

  1. Build the project using the OM_OMS_ENABLE_PIP option in CMake:

    cmake -S . -B build/ -DCMAKE_INSTALL_PREFIX=install/ -DOM_OMS_ENABLE_PIP=ON
    cmake --build build/ --target install
  2. Run the Makefile:

    make pip
  3. Upload the package using twine:

    twine upload src/pip/install/dist/OMSimulator-2.1.1.post248.tar.gz

@lochel
Copy link
Member Author

lochel commented Nov 29, 2023

Please be aware that the nightly builds are currently broken, preventing us from uploading new packages.

Exception: Downloading artifact failed for https://build.openmodelica.org/omsimulator/nightly/linux-amd64/OMSimulator-linux-amd64-v2.1.1.post248-gf7c50c9.tar.gz

Copy link
Contributor

@mahge mahge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a top level Makefile is perhaps not a good idea. It will be confusing because one would assume it will be able to build the whole project.

A prewritten Makefile also spoils the flexibility we got from CMake in the sense that users will not be able to chose their build program as they want.

If possible, we should do this in the CMake files (in the respective directory) as a custom target so that it works with other build tools like Ninja, MSBuild.

@lochel
Copy link
Member Author

lochel commented Nov 29, 2023

@mahge We can even remove the Makefile - it doesn't do much except for executing a python script.

@mahge
Copy link
Contributor

mahge commented Nov 29, 2023

@mahge We can even remove the Makefile - it doesn't do much except for executing a python script.

Then we can probably do it in the existing src/pip/CMakeLists.txt.

@lochel
Copy link
Member Author

lochel commented Nov 29, 2023

Sounds good 😊 any suggestions on how to do it?

@mahge
Copy link
Contributor

mahge commented Nov 30, 2023

Sounds good 😊 any suggestions on how to do it?

Of course 🙂. Something like this in the src/pip/CMakeLists.txt should be enough to create the packages. We can test it and adjust it as needed.

add_custom_target(omsimulator-pip-package
                  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/setup.py
                  COMMAND python3 setup.py sdist
                  COMMENT "Creating OMSimulator pip package."
                  )

This will create a target named omsimulator-pip-package. One can then, for example, run make omsimulator-pip-package in the build directory to create the packages.

@arun3688 arun3688 added the CI/Upload Artifacts Uploads binaries for the given pull request to build.openmodelica.org/omsimulator/experimental/ label Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI/Upload Artifacts Uploads binaries for the given pull request to build.openmodelica.org/omsimulator/experimental/
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants