Continuing to iterate toward the right autoconf/make solution
authorChristopher Allan Webber <cwebber@dustycloud.org>
Sat, 4 Oct 2014 03:57:24 +0000 (22:57 -0500)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Fri, 10 Oct 2014 19:42:16 +0000 (14:42 -0500)
Makefile.in
configure.ac
env.in [new file with mode: 0644]

index 84ba350743237e78781e9722a0dcea67827de96b..d874674adb3f280f79bfd96c1519adfb44117eaa 100644 (file)
@@ -51,51 +51,54 @@ pkgpythondir = @pkgpythondir@
 pkgpyexecdir = @pkgpyexecdir@
 PYTHONPATH = $(pythondir)$(PATH_SEPARATOR)$(DESTDIR)$(pythondir)
 
-all: develop
+# Maybe add a virtualenv prefix to a command
+ifneq ($(VIRTUALENV),no)
+# virtualenv specified to be included by config (default)
+#   ... we only use virtualenv for local development, we don't
+#   auto-deploy to it.
 
-.PHONY: all install develop uninstall distclean info install-html html \
-install-pdf pdf install-dvi dvi install-ps ps clean dist check \
-installdirs postgresql update
+maybe_venved = ./bin/
+maybe_venved_python = ./bin/python
+# Yes, build the virtualenv as a dependency!
+maybe_venv_dep = ./bin/python
 
-# Since installing to a virtualenv is all the rage these days, support
-# it here. If the VIRTUALENV variable is set to anything other than
-# "no", set up a new virtualenv and install there, otherwise install
-# as usual from setup.py
-install: installdirs
-       $(NORMAL_INSTALL)
-ifneq ($(VIRTUALENV),no)
-       $(VIRTUALENV) $(VIRTUALENV_FLAGS) --python=$(PYTHON) \
-               --system-site-packages $(DESTDIR)$(prefix) || \
-               $(VIRTUALENV) $(DESTDIR)$(prefix)
-       $(DESTDIR)$(prefix)/bin/python $(srcdir)/setup.py install \
-               --prefix=$(DESTDIR)$(prefix)
 else
-       $(PYTHON) $(srcdir)/setup.py install --prefix=$(DESTDIR)$(prefix)
+# --without-virtualenv must have been passed in... don't build
+#   a local virtualenv or use such commands
+maybe_venved =
+maybe_venved_python = $(PYTHON)
+# No need for commands to build virtualenv as a dependency!
+maybe_venv_dep = 
 endif
-#      if [[ $(DESTDIR)$(prefix) != $(abs_srcdir) ]]; then \
-#              $(INSTALL_DATA) $(srcdir)/Makefile $(DESTDIR)$(prefix)/Makefile; \
-#              $(INSTALL_DATA) $(srcdir)/lazycelery.sh $(DESTDIR)$(prefix)/lazycelery.sh; \
-#              $(INSTALL_DATA) $(srcdir)/lazyserver.sh $(DESTDIR)$(prefix)/lazyserver.sh; \
-#      fi
-
-# The same as "install", except use the "develop" setup.py target
-develop: installdirs
-       $(NORMAL_INSTALL)
+
+
+
+.PHONY: all install uninstall distclean info install-html html \
+install-pdf pdf install-dvi dvi install-ps ps clean dist check \
+installdirs i18n virtualenv
+# update postgresql
+
+all: develop
+
+develop:
+       echo "nothin yet"
+
+install: installdirs
+       $(maybe_venved_python) $(srcdir)/setup.py install --prefix=$(DESTDIR)$(prefix)
+
+
+i18n: $(maybe_venv_dep)
+       $(maybe_venved)pybabel compile -D mediagoblin -d mediagoblin/i18n/
+
+
 ifneq ($(VIRTUALENV),no)
-       $(VIRTUALENV) $(VIRTUALENV_FLAGS) --python=$(PYTHON) \
-               --system-site-packages $(DESTDIR)$(prefix) || \
-               $(VIRTUALENV) $(DESTDIR)$(prefix)
-       $(DESTDIR)$(prefix)/bin/python $(srcdir)/setup.py develop \
-               --prefix=$(DESTDIR)$(prefix)
-else
-       $(PYTHON) $(srcdir)/setup.py develop --prefix=$(DESTDIR)$(prefix)
-endif
-       if [ "$(DESTDIR)$(prefix)" != "$(abs_srcdir)" ]; then \
-               $(INSTALL_DATA) $(srcdir)/Makefile $(DESTDIR)$(prefix)/Makefile; \
-               $(INSTALL_DATA) $(srcdir)/lazycelery.sh $(DESTDIR)$(prefix)/lazycelery.sh; \
-               $(INSTALL_DATA) $(srcdir)/lazyserver.sh $(DESTDIR)$(prefix)/lazyserver.sh; \
-       fi
+./bin/python:
+       rm -f ./bin/python
+       virtualenv --system-site-packages .
+       ./bin/python setup.py develop --upgrade
 
+virtualenv: bin/python
+endif
 
 # setup.py doesn't (yet) support an uninstall command, so until it does, you 
 # must manually remove everything that was installed here. The following example
@@ -110,7 +113,7 @@ endif
 
 # Just use the usual setup.py clean command
 clean:
-       $(PYTHON) setup.py clean
+       $(maybe_venved_python) setup.py clean
 
 
 # Clean up the output of configure
@@ -123,7 +126,7 @@ distclean:
 
 # You can either use the setup.py sdist command or you can roll your own here
 dist:
-#      $(PYTHON) setup.py sdist
+#      $(maybe_venved_python) setup.py sdist
        mkdir $(PACKAGE_DISTNAME)
        cp -r $(DISTFILES) $(PACKAGE_DISTNAME)
        tar -czf $(PACKAGE_DISTNAME).tar.gz $(PACKAGE_DISTNAME)
@@ -131,25 +134,25 @@ dist:
 
 # Use the setup.py check command
 check:
-       $(PYTHON) setup.py check
+       $(maybe_venved_python) setup.py check
 
 # setup.py might complain if a directory doesn't exist so just in case, make the directory
 # here
 installdirs:
        $(MKDIR_P) $(DESTDIR)$(prefix)
 
-# Set up PostgreSQL
-postgresql:
-       sudo -u $(POSTGRES) createuser mediagoblin
-       sudo -u $(POSTGRES) createdb -E UNICODE -O mediagoblin mediagoblin
+# Set up PostgreSQL
+postgresql:
+#      sudo -u $(POSTGRES) createuser mediagoblin
+#      sudo -u $(POSTGRES) createdb -E UNICODE -O mediagoblin mediagoblin
 
-update:
-ifneq ($(VIRTUALENV),no)
-       $(prefix)/bin/python $(srcdir)/setup.py develop --prefix=$(prefix) --upgrade
-else
-       $(PYTHON) $(srcdir)/setup.py develop --prefix=$(prefix) --upgrade
-endif  
-       $(prefix)/bin/gmg dbupdate
+update:
+ifneq ($(VIRTUALENV),no)
+#      $(prefix)/bin/python $(srcdir)/setup.py develop --prefix=$(prefix) --upgrade
+else
+#      $(PYTHON) $(srcdir)/setup.py develop --prefix=$(prefix) --upgrade
+# endif        
+#      $(prefix)/bin/gmg dbupdate
 
 # The following show how to install documentation. In this example,
 # docs are built from a separate Makefile contained in the docs
@@ -194,6 +197,8 @@ ifneq ($(SPHINXBUILD),no)
 endif
 
 
+# Targets that don't seem supported?
+
 install-dvi:
 
 dvi:
index 396e7a5eec6b03ec5f1e960daff161cf77fd450c..40d045f080d37d7fdbe3b745222f6437869c1dfc 100644 (file)
@@ -1,6 +1,7 @@
 dnl configure.ac
 dnl
 dnl Copyright 2012, 2013 Brandon Invergo <brandon@invergo.net>
+dnl           2014 MediaGoblin contributors (see MediaGoblin's AUTHORS)
 dnl
 dnl Copying and distribution of this file, with or without modification,
 dnl are permitted in any medium without royalty provided the copyright
@@ -56,9 +57,9 @@ dnl
 AC_CONFIG_MACRO_DIR([m4])
 
 
-# The default prefix should be changed from /usr/local. Set it, as in
-# the documentation, to /srv/mediagoblin.example.org/mediagoblin/
-AC_PREFIX_DEFAULT([`pwd`])
+dnl # The default prefix should be changed from /usr/local. Set it, as in
+dnl # the documentation, to /srv/mediagoblin.example.org/mediagoblin/
+dnl AC_PREFIX_DEFAULT([`pwd`])
 
 
 dnl###########################
@@ -84,7 +85,7 @@ dnl          series and the max is in the 3.0 series, non-existent
 dnl          releases (2.8 & 2.9) will be correctly skipped.
 dnl----
 dnl
-PC_INIT([2.7], [3.3.1])
+dnl PC_INIT([2.7], [3.3.1])
 
 
 dnl--PC_PROG_PYTHON---------------------------------------------------
@@ -126,12 +127,12 @@ dnl available, checking both for "virtualenv" and "virtualenv2"
 dnl (AC_CHECK_PROGS)
 dnl----
 dnl
-# Support installing to a virtualenv via the --with-virtualenv 
+# Support doing development in a virtualenv via the --with-virtualenv 
 # configure flag
 AC_ARG_WITH([virtualenv],
-       [AS_HELP_STRING([--with-virtualenv], [install to a Python virtualenv])],
+       [AS_HELP_STRING([--without-virtualenv], [install to a Python virtualenv])],
        [],
-       [with_virtualenv=no])
+       [with_virtualenv=yes])
 AS_IF([test "x$with_virtualenv" != xno],
            AC_CHECK_PROGS([VIRTUALENV], [virtualenv virtualenv3 virtualenv2], [no])
            AS_IF([test "x$VIRTUALENV" = xno],
@@ -401,11 +402,16 @@ dnl
 dnl PC_PYTHON_CHECK_ABI_FLAGS
 
 
+dnl--MediaGoblin specific variables ----------------------------------
+
+
 dnl#########
 dnl Finish #
 dnl#########
 
 dnl Define the files to be configured
 AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([env], [chmod +x env])
+
 dnl Generate config.status
 AC_OUTPUT
diff --git a/env.in b/env.in
new file mode 100644 (file)
index 0000000..9dc1208
--- /dev/null
+++ b/env.in
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+our_python=@PYTHON@
+