<commit_before>##======- Makefile.sage ---------------------------------*- Makefile -*-======##
##===----------------------------------------------------------------------===##

SAGE_VERSION = 6.4.1
SAGE_INSTALLED_VERSION = $(shell sage --version)

QEPCAD_PACKAGE_URL = http://cuda.dcc.ufmg.br/sage/qepcad-1.50.spkg

ifneq ($(findstring Sage Version $(SAGE_VERSION),$(SAGE_INSTALLED_VERSION)),)
  ifeq ($(shell sage -c "print is_package_installed('qepcad')"),False)
    $(error Please install the QEPCAD package for SAGE)
  endif

./bin/sage: sage
	ln -s $(shell which sage) $@

else
  SAGE_ARCH = $(shell uname -m)

  OS=$(shell uname -s)
  ifeq ($(OS), Linux)
    ifeq ($(SAGE_ARCH), x86_64)
      SAGE_BITS = 64
    else ifeq ($(SAGE_ARCH), i386)
      SAGE_BITS = 32
    else
      $(error Unknown architecture: $(SAGE_ARCH))
    endif

    SAGE_OS = Linux-Ubuntu_8.04_$(SAGE_ARCH)
    SAGE_PACKAGE = sage-$(SAGE_VERSION)-$(SAGE_ARCH)-$(SAGE_OS).tar.gz
    SAGE_LINK = http://cuda.dcc.ufmg.br/sage/$(SAGE_PACKAGE)

sage: $(SAGE_PACKAGE)
	mkdir -p sage
	tar -xvf $(SAGE_PACKAGE) -C sage --strip-components=1
	yes | ./sage/sage -i $(QEPCAD_PACKAGE_URL)

  else ifeq ($(OS), Darwin)
    ifneq ($(SAGE_ARCH), x86_64)
      $(error SAGE does not provide 32-bit packages for OSX)
    endif

    SAGE_OS = Darwin-OSX_10.7_$(SAGE_ARCH)
    SAGE_PACKAGE = sage-$(SAGE_VERSION)-$(SAGE_ARCH)-$(SAGE_OS).dmg
    SAGE_LINK = http://linorg.usp.br/sage/osx/intel/$(SAGE_PACKAGE)

sage: $(SAGE_PACKAGE)
	hdiutil mount -mountpoint /Volumes/sage $(SAGE_PACKAGE)
	cp -r /Volumes/sage/sage .
	yes | ./sage/sage -i $(QEPCAD_PACKAGE_URL)

  else
    $(error Unknown operating system: $(OS))
  endif

./bin/sage: sage
	ln -s $(shell pwd)/sage/sage $@
	touch $(shell pwd)/sage/sage

$(SAGE_PACKAGE):<commit_msg>Update SAGE to version 6.8 for GNU/Linux<commit_after>##======- Makefile.sage ---------------------------------*- Makefile -*-======##
##===----------------------------------------------------------------------===##

SAGE_VERSION = 6.8
SAGE_INSTALLED_VERSION = $(shell sage --version)

QEPCAD_PACKAGE_URL = http://cuda.dcc.ufmg.br/sage/qepcad-1.50.spkg

ifneq ($(findstring Sage Version $(SAGE_VERSION),$(SAGE_INSTALLED_VERSION)),)
  ifeq ($(shell sage -c "print is_package_installed('qepcad')"),False)
    $(error Please install the QEPCAD package for SAGE)
  endif

./bin/sage: sage
	ln -s $(shell which sage) $@

else
  SAGE_ARCH = $(shell uname -m)

  OS=$(shell uname -s)
  ifeq ($(OS), Linux)
    ifeq ($(SAGE_ARCH), x86_64)
      SAGE_BITS = 64
    else ifeq ($(SAGE_ARCH), i386)
      SAGE_BITS = 32
    else
      $(error Unknown architecture: $(SAGE_ARCH))
    endif

    SAGE_OS = Ubuntu_12.04_LTS
    SAGE_PACKAGE = $(SAGE_OS)_sage-$(SAGE_VERSION)-$(SAGE_ARCH)-Linux.tar.lrz
    SAGE_LINK = http://sagemath.c3sl.ufpr.br/linux/64bit/$(SAGE_PACKAGE)

sage: $(SAGE_PACKAGE)
	lrzuntar $(SAGE_PACKAGE)
	mv sage-$(SAGE_VERSION)-$(SAGE_ARCH)-Linux sage
	yes | ./sage/sage -i $(QEPCAD_PACKAGE_URL)

  else ifeq ($(OS), Darwin)
    ifneq ($(SAGE_ARCH), x86_64)
      $(error SAGE does not provide 32-bit packages for OSX)
    endif

    # Override the SAGE version while OS X packages aren't available for 6.8.
    SAGE_VERSION = 6.7
    SAGE_OS = Darwin-OSX_10.7_$(SAGE_ARCH)
    SAGE_PACKAGE = sage-$(SAGE_VERSION)-$(SAGE_ARCH)-$(SAGE_OS).dmg
    SAGE_LINK = http://linorg.usp.br/sage/osx/intel/$(SAGE_PACKAGE)

sage: $(SAGE_PACKAGE)
	hdiutil mount -mountpoint /Volumes/sage $(SAGE_PACKAGE)
	cp -r /Volumes/sage/sage .
	yes | ./sage/sage -i $(QEPCAD_PACKAGE_URL)

  else
    $(error Unknown operating system: $(OS))
  endif

./bin/sage: sage
	ln -s $(shell pwd)/sage/sage $@
	touch $(shell pwd)/sage/sage

$(SAGE_PACKAGE):
{'fraction_non_alphanumeric': 0.21194190424959655, 'fraction_numerical': 0.01828940290478752, 'mean_word_length': 2.865904365904366, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '1943683', 'n_tokens_mistral': 1533, 'n_tokens_neox': 1428, 'n_words': 297}