-
Notifications
You must be signed in to change notification settings - Fork 118
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
fix make setup #155
Comments
Maybe a 'python' script that checks stuff? |
Creating a script to check all the points you've listed requires calling external commands from Python and checking for their existence and results. Here's a basic example for each: import subprocess
import os
def check_command(cmd, expected_in_output=None):
try:
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True, universal_newlines=True)
if expected_in_output:
return expected_in_output in output
else:
return True
except subprocess.CalledProcessError as e:
return False
except Exception as e:
print(f"Error running command {cmd}: {e}")
return False
def main():
# Check if R is installed and its version
if check_command("R --version"):
print("R is installed.")
version = subprocess.check_output("R --version", shell=True).decode('utf-8').split('\n')[0]
print(version)
else:
print("R is not installed.")
# Check if Rscript can be executed
if check_command("Rscript -e 'print(1+1)'", "2"):
print("Rscript can be executed from the command prompt.")
else:
print("Cannot execute Rscript from the command prompt.")
# Check if packages can be installed in R
if check_command("R -e 'install.packages(\"dplyr\", repos=\"https://cran.rstudio.com/\")'"):
print("Packages can be installed in R.")
else:
print("Packages cannot be installed in R.")
# Check if Python is installed
if check_command("python --version"):
print("Python is installed.")
else:
print("Python is not installed.")
# Check if Anaconda/conda is installed
if check_command("conda --version"):
print("Anaconda/conda is installed.")
else:
print("Anaconda/conda is not installed.")
# Check if 'make' can be used
if check_command("make --version"):
print("'make' tool is available.")
else:
print("'make' tool is not available.")
# Check if R can knit RMarkdown documents
if check_command("R -e 'rmarkdown::render(\"example.Rmd\")'", "output file: example.html"):
print("R can knit RMarkdown documents.")
else:
print("R cannot knit RMarkdown documents.")
# Check if git is installed
if check_command("git --version"):
print("Git is installed.")
else:
print("Git is not installed.")
# Check if git can push and pull might require an actual repository and action.
# I'll leave a note about this.
print("Note: Checking if git can push and pull requires an actual repository and action. Manual check recommended.")
if __name__ == "__main__":
main() Note:
Please be aware that executing this script may make changes to your system (like installing an R package). Adjust the commands accordingly based on your needs. Always backup your data and understand the implications of running scripts that interact with system commands. |
this year, students experienced a lot of troubles getting make installed. although the instructions are correct, half of the class wasn't ready in week 5 to execute make code or launch R from the command prompt.
a few options:
The text was updated successfully, but these errors were encountered: