[mousetrap/gnome3-wip: 199/240] Fixed a few issues



commit 82ec4b513c0a4e4f60211f52820a44ebc4d74da2
Author: Kevin Brown <kevin kevinbrown in>
Date:   Sat Jun 28 15:46:13 2014 -0400

    Fixed a few issues
    
    Because the `MANIFEST.in` file was not included in the distribution,
    the haar, locale, and configuration file were not being installed
    correctly.
    
    The build is now being done from the source directory, as `setup.py`
    a problem if it is not run within the directory where it is located,
    which caused the build to exit early.
    
    The `egg-info` directory is now being generated within the build
    directory.  Previously it was generated within the current
    directory, which resulted in the source directory being changed.
    The source directory may be read-only, so this is not allowed and
    distcheck will fail as a result.
    
    The `lib` directory can have a suffix in some cases, so we now use
    `find` to locate the correct directory to add to the `PYTHONPATH`.
    This is used for both `make run` and `make check` to ensure that
    the PYTHONPATH is set correctly.

 Makefile.am |   21 ++++++++++++---------
 setup.py    |   12 +++++++-----
 2 files changed, 19 insertions(+), 14 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index f052a50..c957f3b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,6 +2,7 @@ mousetrapdir=$(pkgpythondir)
 
 EXTRA_DIST= \
        setup.py \
+       MANIFEST.in \
        src/mousetrap
 
 
@@ -9,9 +10,9 @@ EXTRA_DIST= \
 # TARGET: all
 
 all-local:
-       $(PYTHON) $(srcdir)/setup.py build \
-               --build-base $(builddir)/build \
-               --verbose
+       (cd $(srcdir); $(PYTHON) setup.py build \
+               --build-base $(shell readlink -f $(builddir))/build \
+               --verbose)
 
 
 ##############################################################################
@@ -48,7 +49,7 @@ install-exec-local:
 
 uninstall-local:
        cat $(DESTDIR)$(pkgpythondir)/install_files.txt | xargs rm -rf
-       rm -r $(DESTDIR)$(pkgpythondir)
+       rm -rf $(DESTDIR)$(pkgpythondir)
 
 
 ##############################################################################
@@ -65,7 +66,7 @@ clean-local:
 # TARGET: distclean
 
 distclean-local:
-       rm -rf $(builddir)/mousetrap.egg-info
+       rm -rf $(builddir)/build/mousetrap.egg-info
 
 
 ##############################################################################
@@ -110,10 +111,12 @@ $(POTFILE): $(PYTHON_FILES)
 ##############################################################################
 # TARGET: check
 
+MT_BUILD_HOME = $(shell dirname $(shell find "$(builddir)/build" -mindepth 2 -maxdepth 2 -type d -name 
"mousetrap"))
+MT_BUILD_TESTS = $(shell find "$(MT_BUILD_HOME)/mousetrap" -name "run_python_tests.py")
 
 check-local:
-       PYTHONPATH=$(builddir)/build/lib ; \
-       $(PYTHON) `find "$(builddir)" -name "run_python_tests.py"`
+       PYTHONPATH=$(MT_BUILD_HOME) \
+       $(PYTHON) $(MT_BUILD_TESTS)
 
 
 ##############################################################################
@@ -127,5 +130,5 @@ lint:
 # TARGET: run
 
 run: all
-       PYTHONPATH=$(builddir)/build/lib ; \
-       $(PYTHON) $(builddir)/build/lib/mousetrap/main.py
+       PYTHONPATH=$(MT_BUILD_HOME) \
+       $(PYTHON) $(MT_BUILD_HOME)/mousetrap/main.py
diff --git a/setup.py b/setup.py
index 48e4379..a1dc420 100644
--- a/setup.py
+++ b/setup.py
@@ -98,6 +98,13 @@ On yum-based systems:
 The installation not work as expected without this dependency.
 """)
 
+        if "build" in self.distribution.command_obj:
+            build_command = self.distribution.command_obj["build"]
+
+            self.egg_base = build_command.build_base
+
+            self.egg_info = os.path.join(self.egg_base, os.path.basename(self.egg_info))
+
         egg_info.run(self)
 
 
@@ -170,9 +177,4 @@ setup(
         "Programming Language :: Python :: 2",
         "Programming Language :: Python :: 2.7",
     ],
-    options={
-        "egg_info": {
-            "egg_base": ".",
-        }
-    },
 )


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]