From 5699ab2d1f349fb2cc902d0fc5d1652cea4ed222 Mon Sep 17 00:00:00 2001
From: Kareem Zidane <kzidane@cs50.harvard.edu>
Date: Tue, 24 Jan 2017 21:52:22 +0200
Subject: [PATCH] tweaks Makefile and moves permissions there

---
 Makefile         | 22 ++++++++++++----------
 after-install.sh |  3 ---
 2 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/Makefile b/Makefile
index ded7c8f..58a3359 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,12 @@
-BUILD_DIR = build
-DESCRIPTION = CS50 Library for Python
-MAINTAINER = CS50 <sysadmins@cs50.harvard.edu>
-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
+PYTHON3_DIR := $(LIB_DIR)/python3/dist-packages/cs50
+DESCRIPTION := CS50 Library for Python
+MAINTAINER := CS50 <sysadmins@cs50.harvard.edu>
+NAME := python-cs50
+OLD_NAME := lib50-python
+VERSION := 1.2.4
 
 .PHONY: bash
 bash:
@@ -11,10 +14,9 @@ bash:
 
 .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/* {} \;
+	chmod -R a+rX "$(PYTHON2_DIR)" "$(PYTHON3_DIR)"
 
 .PHONY: clean
 clean:
diff --git a/after-install.sh b/after-install.sh
index cb3373b..bca4a33 100644
--- a/after-install.sh
+++ b/after-install.sh
@@ -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