From 7f51813c2c0a101f1783a4af4acadb587b95e556 Mon Sep 17 00:00:00 2001 From: Luke Campagnola <> Date: Thu, 27 Dec 2012 01:52:32 -0500 Subject: [PATCH] Added MANIFEST.in for generating cleaner source distributions updated versioning system --- MANIFEST.in | 7 +++++++ pyqtgraph/__init__.py | 24 +++++++++++++++--------- 2 files changed, 22 insertions(+), 9 deletions(-) create mode 100644 MANIFEST.in diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 00000000..fb08e7e5 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,7 @@ +recursive-include pyqtgraph *.py *.ui *.m README *.txt +recursive-include tests *.py *.ui +recursive-include examples *.py *.ui +recursive-include doc *.rst *.py *.svg *.png *.jpg +recursive-include doc/build/html * +include doc/Makefile doc/make.bat + diff --git a/pyqtgraph/__init__.py b/pyqtgraph/__init__.py index 6e950770..93d9f7b8 100644 --- a/pyqtgraph/__init__.py +++ b/pyqtgraph/__init__.py @@ -1,5 +1,10 @@ # -*- coding: utf-8 -*- -REVISION = None +""" +PyQtGraph - Scientific Graphics and GUI Library for Python +www.pyqtgraph.org +""" + +__version__ = None ### import all the goodies and add some helper functions for easy CLI use @@ -63,19 +68,21 @@ def systemInfo(): from .Qt import VERSION_INFO print("qt bindings: %s" % VERSION_INFO) - global REVISION - if REVISION is None: ## this code was probably checked out from bzr; look up the last-revision file - lastRevFile = os.path.join(os.path.dirname(__file__), '.bzr', 'branch', 'last-revision') + global __version__ + rev = None + if __version__ is None: ## this code was probably checked out from bzr; look up the last-revision file + lastRevFile = os.path.join(os.path.dirname(__file__), '..', '.bzr', 'branch', 'last-revision') if os.path.exists(lastRevFile): - REVISION = open(lastRevFile, 'r').read().strip() + rev = open(lastRevFile, 'r').read().strip() - print("pyqtgraph: %s" % REVISION) + print("pyqtgraph: %s; %s" % (__version__, rev)) print("config:") import pprint pprint.pprint(CONFIG_OPTIONS) ## Rename orphaned .pyc files. This is *probably* safe :) - +## We only do this if __version__ is None, indicating the code was probably pulled +## from the repository. def renamePyc(startDir): ### Used to rename orphaned .pyc files ### When a python file changes its location in the repository, usually the .pyc file @@ -108,9 +115,8 @@ def renamePyc(startDir): print(" " + name2) os.rename(fileName, name2) -import os path = os.path.split(__file__)[0] -if not hasattr(sys, 'frozen'): ## If we are frozen, there's a good chance we don't have the original .py files anymore. +if __version__ is None and not hasattr(sys, 'frozen') and sys.version_info[0] == 2: ## If we are frozen, there's a good chance we don't have the original .py files anymore. renamePyc(path)