PictoPy icon indicating copy to clipboard operation
PictoPy copied to clipboard

Added Fedora compatibility

Open DhruvK278 opened this issue 5 months ago • 4 comments

Addressed Issues:

Fixes #1309 Previously, the automated setup.sh script only supported Debian-based Linux distributions (like Ubuntu) and would exit with an "Unsupported OS" warning on Fedora. Additionally, manual configuration guides only listed Debian-specific package names. This PR introduces native Fedora support to the automated setup workflow and manual documentation.

Key changes

  1. Fedora/RedHat support in setup.sh:
  • Added detection for /etc/fedora-release and /etc/redhat-release.
  • Mapped Debian-specific system dependencies to their Fedora (dnf) equivalents (e.g., webkit2gtk4.1-devel, libxdo-devel, @development-tools).
  1. Setup script stability & robustness:
  • Resolved relative path constraints by dynamically resolving the script's directory and REPO_ROOT dynamically using $BASH_SOURCE[0]. This allows running setup.sh from any directory.
  • Added cleanup steps (rm -rf virtual environments) to ensure re-runs of the setup script start from a clean state.
  1. Documentation Updates:
  • Updated docs/Manual_Setup_Guide.md to list Fedora-specific dependency installation commands in step 1 of the Tauri Frontend Setup.

Recording

Here is the recording of the setup https://drive.google.com/file/d/1y8EW4RuzapZdQbPAOH6oh0LXLx8aBLEW/view?usp=sharing

AI Usage Disclosure:

We encourage contributors to use AI tools responsibly when creating Pull Requests. While AI can be a valuable aid, it is essential to ensure that your contributions meet the task requirements, build successfully, include relevant tests, and pass all linters. Submissions that do not meet these standards may be closed without warning to maintain the quality and integrity of the project. Please take the time to understand the changes you are proposing and their impact. AI slop is strongly discouraged and may lead to banning and blocking. Do not spam our repos with AI slop.

Check one of the checkboxes below:

  • [x] This PR contains AI-generated code. I have read the AI Usage Policy and this PR complies with this policy. I have tested the code locally and I am responsible for it.

I have used the following AI models and tools: TODO

Checklist

  • [x] My PR addresses a single issue, fixes a single bug or makes a single improvement.
  • [x] My code follows the project's code style and conventions
  • [x] If applicable, I have made corresponding changes or additions to the documentation
  • [x] My changes generate no new warnings or errors
  • [x] I have joined the Discord server and I will share a link to this PR with the project maintainers there
  • [x] I have read the Contribution Guidelines
  • [x] Once I submit my PR, CodeRabbit AI will automatically review it and I will address CodeRabbit's comments.
  • [x] I have filled this PR template completely and carefully, and I understand that my PR may be closed without review otherwise.

Summary by CodeRabbit

  • Documentation

    • Expanded setup guides to explicitly support Fedora/RedHat-based Linux alongside Windows and Debian-based systems.
    • Added Fedora/RedHat-specific troubleshooting steps and package install guidance for missing system dependencies.
  • Chores

    • Improved the automated setup script to detect and support Fedora/RedHat distributions, use distro-appropriate install steps, recreate clean environments during setup, and provide clearer messaging for unsupported Linux environments.

DhruvK278 avatar Jun 09 '26 18:06 DhruvK278

⚠️ This PR has merge conflicts.

Please resolve the merge conflicts before review.

Your PR will only be reviewed by a maintainer after all conflicts have been resolved.

📺 Watch this video to understand why conflicts occur and how to resolve them: https://www.youtube.com/watch?v=Sqsz1-o7nXk

github-actions[bot] avatar Jun 09 '26 18:06 github-actions[bot]

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 13f0aa61-0e0c-499e-b741-27af8da96d28

📥 Commits

Reviewing files that changed from the base of the PR and between bcff15c38154c157dd50758a1b32c5490f889bef and 74fc227e41af7a4a67e804febc4654fcdef89de3.

📒 Files selected for processing (1)
  • scripts/setup.sh
🚧 Files skipped from review as they are similar to previous changes (1)
  • scripts/setup.sh

Walkthrough

This PR extends the project's setup automation and documentation to support Fedora/RedHat-based Linux distributions alongside existing Windows and Debian-based support. Detection logic identifies the distribution, distro-specific package managers install dependencies, and service setup was refactored to use absolute paths from a calculated repository root.

Changes

Fedora/RedHat Linux Distribution Support

Layer / File(s) Summary
Documentation updates for supported platforms
CONTRIBUTING.md, docs/setup.md, docs/Script_Setup_Guide.md, docs/Manual_Setup_Guide.md
Setup guides and contributing documentation expanded to list Windows, Debian-based Linux (Ubuntu), and Fedora/RedHat-based Linux as supported platforms. Fedora-specific troubleshooting sections added to manual setup guide for missing system dependencies and gobject-2.0 errors.
Distribution detection and routing
scripts/setup.js
Node.js setup script now checks for Debian, Fedora, or RedHat release files (/etc/debian_version, /etc/fedora-release, /etc/redhat-release) to route to bash setup, with updated error messaging reflecting all supported distributions.
Bash setup script execution paths
scripts/setup.sh
Setup script computes REPO_ROOT from script location; Fedora/RedHat branch uses dnf for dependencies and NodeSource RPM setup for Node.js, while Debian-based systems use NodeSource Debian setup + apt-get. Service setup uses absolute $REPO_ROOT paths, recreates Python venvs with pip upgrades, and rebuilds frontend from repo-root directories with explicit error handling.

Sequence Diagram(s)

sequenceDiagram
  participant setup_js as scripts/setup.js
  participant os as /etc release files
  participant bash_setup as scripts/setup.sh
  participant pkg_mgr as apt or dnf
  participant services as backend/sync/frontend
  setup_js->>os: check debian_version, fedora-release, redhat-release
  os->>setup_js: distro marker found or not
  alt Supported distro
    setup_js->>bash_setup: invoke bash setup
    bash_setup->>pkg_mgr: install dev-tools + openssl via distro package manager
    bash_setup->>pkg_mgr: install nodejs via NodeSource (Debian) or RPM (Fedora)
    bash_setup->>services: cd to $REPO_ROOT/service, recreate venv, install requirements
    bash_setup->>services: npm install and cargo build in frontend
  else Unsupported
    setup_js->>setup_js: exit with error message
  end

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • AOSSIE-Org/PictoPy#440: Unified setup documentation updates in docs/setup.md, managing the same setup page content that references the expanded platform support introduced here.

Suggested labels

Documentation, TypeScript/JavaScript

Poem

🐰 A script hops through distros with glee,
Fedora and Debian join the spree,
dnf and apt in tidy rows,
Repo root fixed — the workflow grows,
The rabbit cheers, setup runs free.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'Added Fedora compatibility' directly and clearly summarizes the main objective of adding Fedora and RedHat distribution support to PictoPy's setup workflow, matching the core changes across documentation and scripts.
Linked Issues check ✅ Passed The pull request successfully addresses all coding requirements from issue #1309: detection of Fedora/RedHat systems via release files, installation of Fedora-specific package equivalents using dnf, updates to setup.sh and docs/Manual_Setup_Guide.md, and improved script robustness with proper directory resolution and cleanup steps.
Out of Scope Changes check ✅ Passed All changes are directly scoped to adding Fedora/RedHat support: updates to setup scripts, documentation files, and supporting guides. The refactoring of REPO_ROOT directory resolution and virtual environment cleanup are necessary improvements supporting the main objective and do not introduce unrelated changes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • [ ] Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Jun 09 '26 18:06 coderabbitai[bot]

LGTM

@DhruvK278 can you also share a screen recording of a clean installation using the script for Fedora?

rohan-pandeyy avatar Jun 10 '26 07:06 rohan-pandeyy

LGTM

@DhruvK278 can you also share a screen recording of a clean installation using the script for Fedora?

I have updated the PR.

DhruvK278 avatar Jun 10 '26 11:06 DhruvK278

@DhruvK278 have you tested your changes against Windows, made sure the changes do not mess up existing the setup for Windows OS?

rohan-pandeyy avatar Jun 20 '26 18:06 rohan-pandeyy

@DhruvK278

Glad you implemented the Node suggestion.

I would also suggest squashing a few commits. It will help keep the commit tree clean and easier to understand. If issues arise later, it will also make debugging easier.

Also, try to keep commit messages informative and descriptive of the changes being made. For example, the commit message added logs is quite ambiguous and doesn't clearly convey the purpose.

akshajtiwari avatar Jun 20 '26 21:06 akshajtiwari

@DhruvK278 have you tested your changes against Windows, made sure the changes do not mess up existing the setup for Windows OS?

It is working fine, I have tested a clean installation and it works.

DhruvK278 avatar Jun 21 '26 15:06 DhruvK278

@DhruvK278

Glad you implemented the Node suggestion.

I would also suggest squashing a few commits. It will help keep the commit tree clean and easier to understand. If issues arise later, it will also make debugging easier.

Also, try to keep commit messages informative and descriptive of the changes being made. For example, the commit message added logs is quite ambiguous and doesn't clearly convey the purpose.

Thanks for your suggestion will keep in mind next time :)

DhruvK278 avatar Jun 21 '26 15:06 DhruvK278