Skip to content

Commit

Permalink
ENH: Add setup bash script that sets some needed environment vars
Browse files Browse the repository at this point in the history
  • Loading branch information
nstelter-slac committed Mar 4, 2024
1 parent e06796b commit c8f584f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# beamtime-calibration-suite
[![Build Status](https://github.com/slaclab/beamtime-calibration-suite/actions/workflows/run-tests.yml/badge.svg?branch=main)](https://github.com/slaclab/beamtime-calibration-suite/actions/workflows/run-tests.yml)

To run any suite_scripts or use the library in scripts outside the project directory, you need to append the location of your project directory to your PYTHONPATH, for example:
To run any suite_scripts or use the library in scripts outside the project directory,
execute the following command the set some needed environment variables.
```
export PYTHONPATH="${PYTHONPATH}:~/nolan/repos/beamtime-calibration-suite"
source setup.sh
```
_(can add this to your ~/.bashrc so persists between terminal sessions. Library can later have a better release method than cloning and adding to path (pip?))_
_(This must be ran in each new terminal session, or added to your ~/.bashrc file)

## File organization:
* /calibrationSuite: The library code lives here, and the functions can be imported into other scripts as such:
Expand Down
12 changes: 12 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

echo "Setting environment variables..."

# Get the current directory
current_dir=$(pwd)

export PYTHONPATH="$PYTHONPATH:$current_dir"
echo "PYTHONPATH appended with: $current_dir"

export SUITE_SCRIPT="rixSuiteConfig.py"
echo "SUITE_SCRIPT set to: $SUITE_SCRIPT"
2 changes: 0 additions & 2 deletions suite_scripts/AnalyzeH5.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

class AnalyzeH5(object):
def __init__(self):

print ("Nolan")
print('in init')
## this parsing may be common - move elsewhere if so
parser = argparse.ArgumentParser(
Expand Down

0 comments on commit c8f584f

Please sign in to comment.