Skip to content
This repository was archived by the owner on May 14, 2025. It is now read-only.

refactor: MAJOR refactor/beautify of build.sh#632

Open
grenudi wants to merge 1 commit into
ubports:masterfrom
grenudi:master
Open

refactor: MAJOR refactor/beautify of build.sh#632
grenudi wants to merge 1 commit into
ubports:masterfrom
grenudi:master

Conversation

@grenudi

@grenudi grenudi commented Dec 19, 2024

Copy link
Copy Markdown
Contributor

IMPORTANT note:
I removed the ability to pass UBPORTSDOCSENV straight after ./build.sh
like so:

./build.sh ~/ubportsdocsenv/ 

now it's:

./build.sh --env ~/ubportsdocsenv/ 

or for the full output like before it's now:

./build.sh --env ~/ubportsdocsenv/ --verbose

image

image

image

image

image

@grenudi

grenudi commented Dec 19, 2024

Copy link
Copy Markdown
Contributor Author

i think i need to find a better use of my spare time x`) ...

Comment thread build.sh
shift 2
;;
*)
shift

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Let's be a little more defensive here and error out instead of silently ignoring invalid options

Comment thread build.sh
*)
shift
;;
esac

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

shift here instead

Comment thread build.sh
set -Eeou pipefail

# color codes
# fold me :) (in vscode vscodium etc)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't really see the point of a "fold me" comment. Even more so a reference to one particular editor. I don't think this is helpful

Frankly I find the region/end region comments more distracting than helpful. Please remove

Comment thread build.sh


# Function to install dependencies for most Linux systems
install_dependencies_for_most_linux_systems() {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we just call this install_dependencies please

Comment thread build.sh

# Function to install dependencies for most Linux systems
install_dependencies_for_most_linux_systems() {
echo_success "Checking dependencies"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Shouldn't this be plain?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe the detected xyz could be the success?!

Comment thread build.sh
sphinx-build -Wab rediraffecheckdiff . _build/html
}
build_documentation(){
echo_success "Building..."

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Plain

Comment thread build.sh
else
sphinx-build -Wa . _build/html -j `sysctl -n hw.ncpu` || exit $?
fi
sphinx-build -Wab rediraffecheckdiff . _build/html

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should this also || exit ?

That should also allow you to put a echo_success after

Comment thread build.sh
install_via_pacman
else
echo "Unsupported package manager. Please install the packages and create the virtualenv manually."
echo_error "Unsupported package manager. Please install the packages and create the virtualenv manually."

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The way it's implemented right now with exit 1, it's misleading to say users should install dependecies, since even if they did, it would still error out. Better to be factual and just say "Failed to detect package manager"

If the exit would be removed, the script could continue. In that case this should be a warning about package manager detection.

In no case does it make sense to instruct about virtualenv, since this would be a separate subsequent step.

@doniks

doniks commented Dec 29, 2024

Copy link
Copy Markdown
Collaborator

@grenudi maybe have a look at update_translations.sh script. Looks like as if it started as a copy/paste of an older build script. By now it's diverged a lot and with your change would diverge more. Maybe this could be added here instead with a --translation option or something

@grenudi

grenudi commented Dec 29, 2024

Copy link
Copy Markdown
Contributor Author

@grenudi maybe have a look at update_translations.sh script. Looks like as if it started as a copy/paste of an older build script. By now it's diverged a lot and with your change would diverge more. Maybe this could be added here instead with a --translation option or something

ty, I will look into it

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants