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

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

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

Conversation

grenudi
Copy link
Contributor

@grenudi grenudi commented Dec 19, 2024

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
Copy link
Contributor Author

grenudi commented Dec 19, 2024

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

shift 2
;;
*)
shift
Copy link
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

*)
shift
;;
esac
Copy link
Collaborator

Choose a reason for hiding this comment

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

shift here instead

@@ -2,53 +2,200 @@

set -Eeou pipefail

# color codes
# fold me :) (in vscode vscodium etc)
Copy link
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



# Function to install dependencies for most Linux systems
install_dependencies_for_most_linux_systems() {
Copy link
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


# Function to install dependencies for most Linux systems
install_dependencies_for_most_linux_systems() {
echo_success "Checking dependencies"
Copy link
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
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?!

sphinx-build -Wab rediraffecheckdiff . _build/html
}
build_documentation(){
echo_success "Building..."
Copy link
Collaborator

Choose a reason for hiding this comment

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

Plain

else
sphinx-build -Wa . _build/html -j `sysctl -n hw.ncpu` || exit $?
fi
sphinx-build -Wab rediraffecheckdiff . _build/html
Copy link
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

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
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
Copy link
Collaborator

doniks commented Dec 29, 2024

@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
Copy link
Contributor Author

grenudi commented Dec 29, 2024

@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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants