<commit_before>PROJECT_NAME=ejpi
PACKAGE_NAME=$(PROJECT_NAME)

SOURCE_PATH=$(PACKAGE_NAME)
SOURCE=$(shell find $(SOURCE_PATH) -iname "*.py")

PROGRAM=$(PROJECT_NAME)-calc
DIST_BASE_PATH=./dist
ICON_SIZES=22 28 32 48 80
ICONS=$(foreach size, $(ICON_SIZES), data/icons/$(size)/$(PROJECT_NAME).png)
PACKAGE_VARIANTS=fremantle harmattan ubuntu
DESKTOP_FILES=$(foreach variant, $(PACKAGE_VARIANTS), data/$(variant)/$(PROJECT_NAME).desktop)
SETUP_FILES=$(foreach variant, $(PACKAGE_VARIANTS), ./setup.$(variant).py)
DIST_PATHS=$(foreach variant, $(PACKAGE_VARIANTS), $(DIST_BASE_PATH)_$(variant)) $(DIST_BASE_PATH)_diablo

OBJ=$(SOURCE:.py=.pyc)
TAG_FILE=~/.ctags/$(PROJECT_NAME).tags
TODO_FILE=./TODO

DEBUGGER=winpdb
UNIT_TEST=nosetests --with-doctest -w .
SYNTAX_TEST=support/test_syntax.py
STYLE_TEST=../../Python/tools/pep8.py --ignore=W191,E501
LINT_RC=./support/pylint.rc
LINT=pylint --rcfile=$(LINT_RC)
PROFILE_GEN=python -m cProfile -o .profile
PROFILE_VIEW=python -m pstats .profile
TODO_FINDER=support/todo.py
CTAGS=ctags-exuberant


.PHONY: all run profile debug test build lint tags todo clean distclean

all: test

run: $(OBJ)
	$(PROGRAM)

profile: $(OBJ)
	$(PROFILE_GEN) $(PROGRAM)
	$(PROFILE_VIEW)

debug: $(OBJ)
	$(DEBUGGER) $(PROGRAM)

test: $(OBJ)
	$(UNIT_TEST)

package: $(OBJ) $(ICONS) $(SETUP_FILES) $(DESKTOP_FILES)
	rm -Rf $(DIST_BASE_PATH)_*/*
	./setup.fremantle.py sdist_diablo -d $(DIST_BASE_PATH)_diablo
	./setup.fremantle.py sdist_fremantle -d $(DIST_BASE_PATH)_fremantle
	./setup.harmattan.py sdist_harmattan -d $(DIST_BASE_PATH)_harmattan
	./setup.ubuntu.py sdist_ubuntu -d $(DIST_BASE_PATH)_ubuntu
	mkdir $(DIST_BASE_PATH)_ubuntu/build
	cd $(DIST_BASE_PATH)_ubuntu/build ; tar -zxvf ../*.tar.gz
	cd $(DIST_BASE_PATH)_ubuntu/build ; dpkg-buildpackage -tc -rfakeroot -us -uc

upload:
	dput diablo-extras-builder $(DIST_BASE_PATH)_diablo/$(PROJECT_NAME)*.changes
	dput fremantle-extras-builder $(DIST_BASE_PATH)_fremantle/$(PROJECT_NAME)*.changes
	cp $(DIST_BASE_PATH)_ubuntu/*.deb www/ejpi.deb

lint: $(OBJ)
	$(foreach file, $(SOURCE), $(LINT) $(file) ; )

tags: $(TAG_FILE) 

todo: $(TODO_FILE)

clean:
	rm -Rf $(OBJ)
	rm -Rf $(TODO_FILE)
	rm -f $(ICONS) $(SETUP_FILES) $(DESKTOP_FILES)
	rm -Rf $(DIST_PATHS)

distclean: clean
	find $(SOURCE_PATH) -name "*.*~" | xargs rm -f
	find $(SOURCE_PATH) -name "*.swp" | xargs rm -f
	find $(SOURCE_PATH) -name "*.bak" | xargs rm -f
	find $(SOURCE_PATH) -name ".*.swp" | xargs rm -f


$(SETUP_FILES): VARIANT=$(word 2, $(subst ., ,$@))

setup.fremantle.py: setup.py src/constants.py
	cog.py -c \
		-D DESKTOP_FILE_PATH==/usr/share/applications/hildon \
		-D INPUT_DESKTOP_FILE=data/$(VARIANT)/$(PROJECT_NAME).desktop \
		-o $@ $<
	chmod +x $@

setup.harmattan.py: setup.py src/constants.py
	cog.py -c \
		-D DESKTOP_FILE_PATH=/usr/share/applications \
		-D INPUT_DESKTOP_FILE=data/$(VARIANT)/$(PROJECT_NAME).desktop \
		-o $@ $<<commit_msg>Fixing installation path for desktop file<commit_after>PROJECT_NAME=ejpi
PACKAGE_NAME=$(PROJECT_NAME)

SOURCE_PATH=$(PACKAGE_NAME)
SOURCE=$(shell find $(SOURCE_PATH) -iname "*.py")

PROGRAM=$(PROJECT_NAME)-calc
DIST_BASE_PATH=./dist
ICON_SIZES=22 28 32 48 80
ICONS=$(foreach size, $(ICON_SIZES), data/icons/$(size)/$(PROJECT_NAME).png)
PACKAGE_VARIANTS=fremantle harmattan ubuntu
DESKTOP_FILES=$(foreach variant, $(PACKAGE_VARIANTS), data/$(variant)/$(PROJECT_NAME).desktop)
SETUP_FILES=$(foreach variant, $(PACKAGE_VARIANTS), ./setup.$(variant).py)
DIST_PATHS=$(foreach variant, $(PACKAGE_VARIANTS), $(DIST_BASE_PATH)_$(variant)) $(DIST_BASE_PATH)_diablo

OBJ=$(SOURCE:.py=.pyc)
TAG_FILE=~/.ctags/$(PROJECT_NAME).tags
TODO_FILE=./TODO

DEBUGGER=winpdb
UNIT_TEST=nosetests --with-doctest -w .
SYNTAX_TEST=support/test_syntax.py
STYLE_TEST=../../Python/tools/pep8.py --ignore=W191,E501
LINT_RC=./support/pylint.rc
LINT=pylint --rcfile=$(LINT_RC)
PROFILE_GEN=python -m cProfile -o .profile
PROFILE_VIEW=python -m pstats .profile
TODO_FINDER=support/todo.py
CTAGS=ctags-exuberant


.PHONY: all run profile debug test build lint tags todo clean distclean

all: test

run: $(OBJ)
	$(PROGRAM)

profile: $(OBJ)
	$(PROFILE_GEN) $(PROGRAM)
	$(PROFILE_VIEW)

debug: $(OBJ)
	$(DEBUGGER) $(PROGRAM)

test: $(OBJ)
	$(UNIT_TEST)

package: $(OBJ) $(ICONS) $(SETUP_FILES) $(DESKTOP_FILES)
	rm -Rf $(DIST_BASE_PATH)_*/*
	./setup.fremantle.py sdist_diablo -d $(DIST_BASE_PATH)_diablo
	./setup.fremantle.py sdist_fremantle -d $(DIST_BASE_PATH)_fremantle
	./setup.harmattan.py sdist_harmattan -d $(DIST_BASE_PATH)_harmattan
	./setup.ubuntu.py sdist_ubuntu -d $(DIST_BASE_PATH)_ubuntu
	mkdir $(DIST_BASE_PATH)_ubuntu/build
	cd $(DIST_BASE_PATH)_ubuntu/build ; tar -zxvf ../*.tar.gz
	cd $(DIST_BASE_PATH)_ubuntu/build ; dpkg-buildpackage -tc -rfakeroot -us -uc

upload:
	dput diablo-extras-builder $(DIST_BASE_PATH)_diablo/$(PROJECT_NAME)*.changes
	dput fremantle-extras-builder $(DIST_BASE_PATH)_fremantle/$(PROJECT_NAME)*.changes
	cp $(DIST_BASE_PATH)_ubuntu/*.deb www/ejpi.deb

lint: $(OBJ)
	$(foreach file, $(SOURCE), $(LINT) $(file) ; )

tags: $(TAG_FILE) 

todo: $(TODO_FILE)

clean:
	rm -Rf $(OBJ)
	rm -Rf $(TODO_FILE)
	rm -f $(ICONS) $(SETUP_FILES) $(DESKTOP_FILES)
	rm -Rf $(DIST_PATHS)

distclean: clean
	find $(SOURCE_PATH) -name "*.*~" | xargs rm -f
	find $(SOURCE_PATH) -name "*.swp" | xargs rm -f
	find $(SOURCE_PATH) -name "*.bak" | xargs rm -f
	find $(SOURCE_PATH) -name ".*.swp" | xargs rm -f


$(SETUP_FILES): VARIANT=$(word 2, $(subst ., ,$@))

setup.fremantle.py: setup.py src/constants.py
	cog.py -c \
		-D DESKTOP_FILE_PATH=/usr/share/applications/hildon \
		-D INPUT_DESKTOP_FILE=data/$(VARIANT)/$(PROJECT_NAME).desktop \
		-o $@ $<
	chmod +x $@

setup.harmattan.py: setup.py src/constants.py
	cog.py -c \
		-D DESKTOP_FILE_PATH=/usr/share/applications \
		-D INPUT_DESKTOP_FILE=data/$(VARIANT)/$(PROJECT_NAME).desktop \
		-o $@ $<
{'fraction_non_alphanumeric': 0.1718348466678088, 'fraction_numerical': 0.006167551824567415, 'mean_word_length': 5.250535331905781, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '688655', 'n_tokens_mistral': 2580, 'n_tokens_neox': 2409, 'n_words': 439}