-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
boilerplate for new python library product
- Loading branch information
1 parent
3dabd65
commit 55d5639
Showing
4 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Configuration | ||
*.pyc | ||
*~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/sh | ||
|
||
# | ||
# Configuration.default | ||
# | ||
|
||
# | ||
# If the MGICONFIG environment variable does not have a local override, | ||
# use the default "live" settings. | ||
# | ||
if [ "${MGICONFIG}" = "" ] | ||
then | ||
MGICONFIG=/usr/local/mgi/live/mgiconfig | ||
export MGICONFIG | ||
fi | ||
|
||
. ${MGICONFIG}/master.config.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
TAG: none | ||
DATE: 6/1/2017 | ||
STAFF: jsb | ||
CHANGES: | ||
1) new product, initial addition |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
#!/bin/sh | ||
# | ||
# Install | ||
########################################################################### | ||
# | ||
# Purpose: This script compiles all *.py files and copies both the *.py | ||
# and the *.pyc files to the given directory. | ||
# | ||
# Usage: Install <library_directory> | ||
# | ||
# where | ||
# | ||
# library_directory is the full path of the directory where | ||
# the *.py and *.pyc files are copied. | ||
# | ||
########################################################################### | ||
|
||
cd `dirname $0` | ||
|
||
# | ||
# Source the configuration file. | ||
# | ||
. ./Configuration | ||
|
||
# | ||
# Verify the arguments to the script. | ||
# | ||
if [ $# -ne 1 ] | ||
then | ||
echo "Usage: $0 <library_directory>" | ||
exit 1 | ||
fi | ||
LIBRARY_DIRECTORY=$1 | ||
|
||
# | ||
# If the library directory does not exist, create it. | ||
# | ||
if [ ! -d ${LIBRARY_DIRECTORY} ] | ||
then | ||
mkdir -p ${LIBRARY_DIRECTORY} | ||
if [ $? -ne 0 ] | ||
then | ||
echo "Cannot create directory: ${LIBRARY_DIRECTORY}" | ||
exit 1 | ||
fi | ||
fi | ||
|
||
# | ||
# Compile all Python scripts. | ||
# | ||
python -c 'import compileall; compileall.compile_dir(".")' | ||
if [ $? -ne 0 ] | ||
then | ||
echo "Error compiling Python source" | ||
exit 1 | ||
fi | ||
|
||
# | ||
# Set the proper permissions on the Python files. | ||
# | ||
chmod 775 *.py | ||
chmod 664 *.pyc | ||
|
||
# | ||
# Copy the Python files to the given library directory. | ||
# | ||
for FILE in `ls *.py *.pyc` | ||
do | ||
rm -f ${LIBRARY_DIRECTORY}/${FILE} | ||
cp -p ${FILE} ${LIBRARY_DIRECTORY} | ||
if [ $? -ne 0 ] | ||
then | ||
echo "Cannot copy ${FILE} to ${LIBRARY_DIRECTORY}" | ||
exit 1 | ||
fi | ||
done | ||
|
||
exit 0 |