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

tweaks Makefile and moves permissions there #8

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
BUILD_DIR = build
DESCRIPTION = CS50 Library for Python
MAINTAINER = CS50 <[email protected]>
NAME = python-cs50
OLD_NAME = lib50-python
VERSION = 1.2.4
BUILD_DIR := build
LIB_DIR := $(BUILD_DIR)/usr/lib
PYTHON2_DIR := $(LIB_DIR)/python2.7/dist-packages/cs50
Copy link
Member

Choose a reason for hiding this comment

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

So we're (clearly) assuming Python 2.7 here. Is there a more dynamic way to figure out the right path on a system?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure yet! But even sdist (just emailed about) seems to assume this path, by default.

PYTHON3_DIR := $(LIB_DIR)/python3/dist-packages/cs50
DESCRIPTION := CS50 Library for Python
MAINTAINER := CS50 <[email protected]>
NAME := python-cs50
OLD_NAME := lib50-python
VERSION := 1.2.4

.PHONY: bash
bash:
docker run -i --rm -t -v "$(PWD)":/root cs50/cli

.PHONY: build
build: clean
mkdir -p "$(BUILD_DIR)"/usr/lib/python2.7/dist-packages/cs50
cp src/* "$(BUILD_DIR)"/usr/lib/python2.7/dist-packages/cs50
mkdir -p "$(BUILD_DIR)"/usr/lib/python3/dist-packages/cs50
cp src/* "$(BUILD_DIR)"/usr/lib/python3/dist-packages/cs50
mkdir -p "$(PYTHON2_DIR)" "$(PYTHON3_DIR)"
find "$(PYTHON2_DIR)" "$(PYTHON3_DIR)" -maxdepth 0 -exec cp src/* {} \;
Copy link
Member

Choose a reason for hiding this comment

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

Why this cleverness? Why not just cp twice?

Copy link
Member Author

Choose a reason for hiding this comment

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

Just didn't want to write src/* twice, or factor it out, so replaced with this one-liner. Seems I've over-complicated? Might be subject to remove, if we're to transition to sdist, anyway!

chmod -R a+rX "$(PYTHON2_DIR)" "$(PYTHON3_DIR)"

.PHONY: clean
clean:
3 changes: 0 additions & 3 deletions after-install.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#!/bin/bash

pip3 install SQLAlchemy

chmod -R a+rX /usr/lib/python2.7/dist-packages/cs50
chmod -R a+rX /usr/lib/python3/dist-packages/cs50