Commit 94766b42 authored by Olivier Cornu's avatar Olivier Cornu
Browse files

Merge branch 'pack' into develop

parents 424284d7 c8ce646c
# Compiled python files
*.pyc
# Python egg info
*.egg-info/
# Build and distribution folders
build/
dist/
# Last package manifest used
/MANIFEST.in
# Pyromaths Makefile.
#
# See 'make help' for available targets and usage details.
### CONFIG
#
# Pyromaths version
VERSION ?= 13.03
# Archive format(s) produced by 'make src' (bztar,gztar,zip...)
FORMATS ?= bztar,zip
# Verbosity and logging
OUT ?= > /dev/null # uncomment: quieter output
#OUT ?= >> log # uncomment: log output to file
### ENVIRONMENT VARIABLES
#
# Path
PYRO := $(PWD)
DIST := $(PYRO)/dist
BUILD := $(PYRO)/build
ARCHIVE := $(PYRO)/..
# Target-specific build dir (if needed)
BUILDIR = $(BUILD)/$@
# Mac app folder
APP := $(DIST)/Pyromaths.app/Contents
# Project files
FILES := AUTHORS COPYING NEWS pyromaths README setup.py MANIFEST.in src data
### MANIFESTS
#
# Base manifest (README, src/ and test/ auto-included):
MANIFEST := \
include AUTHORS COPYING NEWS \n\
exclude MANIFEST.in \n\
graft data \n
# Minimal install (i.e. without test/ dir):
MANIFEST-min := $(MANIFEST) \
prune test \n
# Full project sources:
MANIFEST-all := $(MANIFEST) \
graft debian \n\
graft utils \n\
include Makefile \n
# Unix:
MANIFEST-unix := $(MANIFEST-min) \
exclude data/qtmac_fr.qm \n\
exclude data/images/pyromaths.icns \n\
exclude data/images/pyromaths.ico \n
# Mac app:
MANIFEST-mac := $(MANIFEST-min) \
prune data/linux \n\
exclude data/images/pyromaths.ico \n\
exclude data/images/pyromaths-banniere.png \n
# Win app:
MANIFEST-win := $(MANIFEST-min) \
prune data/linux \n\
exclude data/qtmac_fr.qm \n\
exclude data/images/pyromaths.icns \n
### SHORTCUTS & COMPATIBILITY
#
ifeq ($(OS),Windows_NT)
# Windows
PYTHON ?= c:/Python27/python.exe
else
# Unix
PYTHON ?= python
ifeq ($(shell uname -s),Darwin)
# Mac/BSD
sed-i := sed -i ''
else
# GNU
sed-i := sed -i
endif
endif
setup := $(PYTHON) setup.py
### MACROS
#
# Remove manifest file, egg-info dir and target build dir, clean-up sources.
clean = rm -f MANIFEST.in && rm -rf src/*.egg-info && rm -rf $(BUILDIR) &&\
find . -name '*~' | xargs rm -f && find . -iname '*.pyc' | xargs rm -f
# src must be after rpm, otherwise rpm produces a .tar.gz file that replaces the
# .tar.gz source file (should $$FORMATS include gztar).
all: egg rpm deb src
help:
#
# Build pyromaths packages in several formats.
#
# Usage (Unix):
# $$ make src # Make full-source archive(s)
# $$ make egg # Make python egg
# $$ make rpm # Make RPM package
# $$ make deb # Make DEB package
# $$ make [all] # Make all previous archives/packages
#
# Usage (Mac):
# $$ make app # Make standalone application
#
# Usage (Windows):
# $$ make exe # Make standalone executable (experimental)
#
# And also:
# $$ make version # Apply target $$VERSION [$(VERSION)] to sources
# $$ make clean # Clean-up build/dist folders and source tree
# $$ make repo # Make debian repository
#
# Notes:
# - Notice the source achive $$FORMATS produced [$(FORMATS)].
# - Mangle with $$OUT to make it quieter/verbose/log to output file.
clean:
# Clean
rm -r $(BUILD)/* || mkdir -p $(BUILD)
rm -r $(DIST)/* || mkdir -p $(DIST)
$(clean)
version:
# Apply target version ($(VERSION)) to sources
$(sed-i) "s/VERSION\s*=\s*'.*'/VERSION = '$(VERSION)'/" src/pyromaths/Values.py
src: version
# Make full-source archive(s) (formats=$(FORMATS))
$(clean)
echo "$(MANIFEST-all)" > MANIFEST.in
$(setup) sdist --formats=$(FORMATS) -d $(DIST) $(OUT)
egg: version
# Make python egg
$(clean)
echo "$(MANIFEST-unix)" > MANIFEST.in
$(setup) bdist_egg -d $(DIST) $(OUT)
rpm: version
# Make RPM package
$(clean)
echo "$(MANIFEST-unix)" > MANIFEST.in
$(setup) bdist --formats=rpm -b $(BUILD) -d $(DIST) $(OUT)
rm $(DIST)/pyromaths-$(VERSION).tar.gz
min: version
# Make minimalist .tar.bz source archive in $(BUILD)
$(clean)
echo "$(MANIFEST-unix)" > MANIFEST.in
$(setup) sdist --formats=bztar -d $(BUILD) $(OUT)
deb: min
# Make DEB archive
$(clean)
cd $(BUILD) && tar -xjf pyromaths-$(VERSION).tar.bz2 &&\
mv pyromaths-$(VERSION) $(BUILDIR) &&\
mv pyromaths-$(VERSION).tar.bz2 pyromaths_$(VERSION).orig.tar.bz2
cp -r debian $(BUILDIR)
cd $(BUILDIR) && debuild clean $(OUT)
cd $(BUILDIR) && debuild -kB39EE5B6 $(OUT) || exit 0
mv $(BUILD)/pyromaths_$(VERSION)-*_all.deb $(DIST)
repo: deb
# Create DEB repository
$(clean)
mkdir -p $(BUILDIR)/dists
cp $(DIST)/pyromaths_$(VERSION)*.deb $(BUILDIR)/dists
cd $(BUILDIR) &&\
sudo dpkg-scanpackages . /dev/null > Packages &&\
sudo dpkg-scanpackages . /dev/null | gzip -c9 > Packages.gz &&\
sudo dpkg-scanpackages . /dev/null | bzip2 -c9 > Packages.bz2 &&\
apt-ftparchive release . > /tmp/Release.tmp &&\
mv /tmp/Release.tmp Release &&\
gpg --default-key "Jérôme Ortais" -bao Release.gpg Release &&\
tar vjcf $(ARCHIVE)/debs-$(VERSION).tar.bz2 dists/ Packages Packages.gz Packages.bz2 Release Release.gpg
data/%.qm: data/%.ts
# Translate new/updated language files
lrelease $< -qm $@
app: version data/qtmac_fr.qm
# Make standalone Mac application
$(clean)
$(setup) py2app -O2 -b $(BUILD) -d $(DIST) $(OUT)
# ..Clean-up unnecessary files/folders
rm -f $(APP)/PkgInfo
cd $(APP)/Resources && rm -rf site.pyc include lib/python2.*/config lib/python2.*/site.pyc
cd $(APP)/Frameworks &&\
rm -rf *.framework/Contents *.framework/Versions/4.0 \
*.framework/Versions/Current *.framework/*.prl \
QtCore.framework/QtCore QtGui.framework/QtGui
cd $(APP)/Frameworks/Python.framework/Versions/2.* &&\
rm -rf include lib Resources
# ..Remove all architectures but x86_64..."
ditto --rsrc --arch x86_64 --hfsCompression $(DIST)/Pyromaths.app $(DIST)/Pyromaths-x86_64.app
exe:
# Make standalone Windows executable
# ..Remove previous builds
rmdir /s /q $(BUILDIR)
rm $(DIST)/Pyromaths-*-win32.exe
# ..Create stripped-down sources
md $(BUILDIR)
xcopy data $(BUILDIR)/data /i /s
xcopy src $(BUILDIR)/src /i /s
copy $(FILES) $(BUILDIR)
move $(BUILDIR)/pyromaths $(BUILDIR)/Pyromaths.py
# ..Create standalone exe
cd $(BUILDIR) && $(setup) innosetup -b $(BUILD) -d $(DIST)
* Construction et packaging:
** Factorisation des setup.py en un seul, commun à toutes les plateformes
** Utilisation de Make pour tout ce qui déborde du périmètre de setup.py (traductions, optimisations...)
** Modification de l'arborescence
** Support du format python EGG (packaging et installation)
* Menu système en français (version OSX)
* Version 64 bits (application OSX)
Version 13.03
* Correction d'un bug d'affichage des pdf
* Ajout de cinq exercices de statistiques niveau cinquième
......
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="fr">
<context>
<name>MAC_APPLICATION_MENU</name>
<message>
<source>Services</source>
<translation>Services</translation>
</message>
<message>
<source>Hide %1</source>
<translation>Masquer %1</translation>
</message>
<message>
<source>Hide Others</source>
<translation>Masquer les autres</translation>
</message>
<message>
<source>Show All</source>
<translation>Tout afficher</translation>
</message>
<message>
<source>Preferences...</source>
<translation>Préférences...</translation>
</message>
<message>
<source>Quit %1</source>
<translation>Quitter %1</translation>
</message>
<message>
<source>About %1</source>
<translation>À propos de %1</translation>
</message>
</context>
<context>
<name>QFileDialog</name>
<message>
<source>&amp;Choose</source>
<translation>&amp;Choisir</translation>
</message>
<name>QFileDialog</name>
<message>
<source>&amp;Save</source>
<translation>Enregistrer</translation>
</message>
</context>
<context>
<name>QDialogButtonBox</name>
<message>
<source>Cancel</source>
<translation>Annuler</translation>
</message>
</context>
</TS>
\ No newline at end of file
#!/bin/bash
VERSION=`date +%y.%m`
PYROPATH=$(cd `dirname $0` && cd .. && pwd)
ARCHIVEPATH=$( cd ${PYROPATH} && cd .. && pwd)
if [ ! -f /usr/bin/debuild ];
then
sudo apt-get install devscripts
fi
if [ ! -f /usr/bin/rpm ];
then
sudo apt-get install rpm
fi
echo "#-------------------------------------
#---- CHANGE LE NUMERO DE VERSION ----
#-------------------------------------"
echo "Quel est le numéro de version ? (Par défaut : ${VERSION})"
read touche
case "$touche" in
"" )
;;
* )
VERSION="$touche"
;;
esac
#---- CHANGE LE NUMÉRO DE VERSION DE PYROMATHS ----
sed -i "s/VERSION = '.*/VERSION = '${VERSION}'/" ${PYROPATH}/src/pyromaths/Values.py
echo "#-------------------------------------------
#---- SUPPRIME LES FICHIERS TEMPORAIRES ----
#-------------------------------------------"
find ${PYROPATH} -iname '*~' | xargs rm
find ${PYROPATH} -iname '*.pyc' | xargs rm
rm /tmp/pyromaths_*
echo "#--------------------------------------------
#---------- CRÉATION DES SOURCES ------------
#--------------------------------------------"
[ -d /tmp/building_pyromaths ] && rm -r /tmp/building_pyromaths
mkdir /tmp/building_pyromaths
cd /tmp/building_pyromaths
cp -r ${PYROPATH}/src ${PYROPATH}/data .
cp ${PYROPATH}/* .
cp -r ${PYROPATH}/scripts/linux/* .
python setup.py sdist --formats=bztar
rm MANIFEST
cp dist/pyromaths-${VERSION}.tar.bz2 ${ARCHIVEPATH}/pyromaths-${VERSION}-sources.tar.bz2
mv dist/pyromaths-${VERSION}.tar.bz2 /tmp/pyromaths_${VERSION}.orig.tar.bz2
echo "#--------------------------------------------
#--------- CRÉATION DU PAQUET DEB -----------
#--------------------------------------------"
debuild clean
debuild -kB39EE5B6
sleep 30
cp /tmp/pyromaths_${VERSION}-?_all.deb ${ARCHIVEPATH}
echo "#--------------------------------------------
#--------- CRÉATION DU PAQUET RPM -----------
#--------------------------------------------"
python setup.py bdist --formats=rpm
mv dist/pyromaths-${VERSION}*.noarch.rpm ${ARCHIVEPATH}
cd ${PYROPATH}
echo "#--------------------------------------------
#---------- CRÉATION DU DÉPÔT DEB -----------
#--------------------------------------------"
rm -r /tmp/building_pyromaths
[ -d /tmp/repo_debian ] && rm -r /tmp/repo_debian
mkdir -p /tmp/repo_debian/dists
mv /tmp/pyromaths_${VERSION}* /tmp/repo_debian/dists
cd /tmp/repo_debian
sudo dpkg-scanpackages . /dev/null > Packages &&
sudo dpkg-scanpackages . /dev/null | gzip -c9 > Packages.gz &&
sudo dpkg-scanpackages . /dev/null | bzip2 -c9 > Packages.bz2 &&
apt-ftparchive release . > /tmp/Release.tmp &&
mv /tmp/Release.tmp Release &&
gpg --default-key "Jérôme Ortais" -bao Release.gpg Release &&
tar vjcf ${ARCHIVEPATH}/debs-${VERSION}.tar.bz2 dists/ Packages Packages.gz Packages.bz2 Release Release.gpg &&
cd ${PYROPATH} &&
rm -r /tmp/repo_debian
echo "#-------------------------------------------
#------- CRÉATION DU BINAIRE WINDOWS -------
#-------------------------------------------"
echo "Appuyer sur une touche pour continuer quand le paquet Windows est prêt..."
read touche
#---- LIENS POUR LE SITE PYROMATHS ----
cat > ${ARCHIVEPATH}/pyrosite.txt << EOF
* !/media/img/debian.png(Linux)! "Pyromaths pour Linux - deb":/telecharger/pyromaths_${VERSION}_all.deb
* !/media/img/redhat.png(Linux)! "Pyromaths pour Linux - rpm":/telecharger/pyromaths-${VERSION}-1.noarch.rpm
* !/media/img/macosx.png(Mac OS X)! "Pyromaths pour Mac OS X":/telecharger/pyromaths-${VERSION}-macos.dmg
* !/media/img/winvista.png(Windows)! "Pyromaths pour Windows":/telecharger/pyromaths-${VERSION}-win32.exe
* !/media/img/source.png(Sources)! "Sources de Pyromaths":/telecharger/pyromaths-${VERSION}-sources.tar.bz2
<hr/>
h4. Nouveautés de cette version :
EOF
include AUTHORS COPYING NEWS pyromaths MANIFEST.in
recursive-include data/images *
recursive-include data/packages *
recursive-include data/templates *
recursive-include data/linux *
recursive-include debian *
[install]
prefix = /usr
install-layout = deb
[bdist_rpm]
install_script = install-rpm.sh
#!/usr/bin/python
# -*- coding: utf-8 -*-
from distutils.core import setup
import glob
# Cruft dedicating to importing version number
import sys
from os.path import dirname, join, realpath
basedir = dirname(realpath(__file__))
sys.path.insert(0, join(basedir,'src'))
from pyromaths.Values import VERSION
setup(name = "pyromaths",
version = VERSION,
description = "Exerciseur de mathématiques créant des fiches aux formats " \
+ "LaTeX et PDF.",
license = "GPL",
author = "Jérôme Ortais",
author_email = "jerome.ortais@pyromaths.org",
url = "http://www.pyromaths.org",
package_dir={'': 'src'},
packages=['pyromaths', 'pyromaths.troisiemes', 'pyromaths.quatriemes',
'pyromaths.cinquiemes', 'pyromaths.sixiemes', 'pyromaths.lycee',
'pyromaths.outils', 'pyromaths.classes'],
data_files=[
('share/pixmaps/', [ 'data/images/pyromaths.png' ] ),
('share/pyromaths/images', [ 'data/images/pyromaths-banniere.png',
'data/images/whatsthis.png' ]
),
('share/applications', ['data/linux/pyromaths.desktop']),
('share/man/man1', ['data/linux/pyromaths.1']),
(r'share/pyromaths/images/vignettes',
glob.glob(r'data/images/vignettes/*.png')),
(r'share/pyromaths/templates', glob.glob(r'data/templates/*.tex')),
(r'share/pyromaths/packages', glob.glob(r'data/packages/*')),
],
scripts = ["pyromaths"],
platforms = ['unix'],
long_description = """Pyromaths est un programme qui a pour but de créer
des exercices type de mathématiques niveau collège et lycée ainsi que leur
corrigé. C’est ce qu’on appelle parfois un exerciseur. Contrairement à de
nombreux autres projets, Pyromaths a pour objectif de proposer une
correction véritablement détaillée des exercices proposés et pas seulement
une solution.
Il permet par exemple de proposer des devoirs maison aux élèves et de leur
distribuer ensuite la correction. Il peut aussi servir à des familles afin
qu’un élève puisse travailler un point du programme et se corriger
ensuite."""
)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment