Commits

Marko Toplak committed 21975a6

Moved trac:BuildingFromSource to the repository.

  • Participants
  • Parent commits e82a939

Comments (0)

Files changed (2)

+== Building From Source ==
+
+=== Prerequisites ===
+
+1. C++ tool-chain. Supported compilers are gcc (g++) for Linux and Mac OS X and Microsoft Visual
+C++ on Windows (MinGW is not supported at this time). Clang also works for MAC OS, but see details below.
+[[BR]]
+
+* On Windows install the free [http://www.microsoft.com/express Visual Studio Express]
+* On Linux use the distribution package management tools 
+* On Mac OSX install the [http://developer.apple.com/xcode XCode developer tools]
+
+You will also need python and numpy development header files. They are included in python
+and numpy installation on Windows and Mac OSX, but are in separate packages on Linux,
+for instance 'python-dev' and python-numpy-dev' on Debian derived distributions.
+
+=== Obtaining source ===
+
+Either:
+
+* Download the latest nightly packed sources archive and unpack it.
+
+* Clone the Mercurial repository:
+
+	hg clone https://bitbucket.org/biolab/orange
+
+== Build and Install==
+
+=== With setup.py (suggested) ===
+
+The easiest way to build Orange from source is to use the setup.py in the root
+Orange directory (requires administrative privileges). Just run:
+
+python setup.py build
+python setup.py install 
+
+Alternatively, you could install Orange into the user specific site-packages 
+(see http://docs.python.org/install/index.html#how-installation-works).
+You will need to add the install dir to PYTHONSITEPACKAGES environment variable 
+(because Python needs to process Orange's .pth file)
+
+If clang is the default compiler it is necessary to add the `-Wno-address-of-temporary`
+flag to the CPPFLAGS environment variable before running setup.py:
+
+export CPPFLAGS=-Wno-address-of-temporary
+python setup.py build
+
+To install in development mode (http://packages.python.org/distribute/setuptools.html#development-mode)
+run the following command instead of "python setup.py install":
+
+    python setup.py develop
+
+=== Using make ===
+
+This is only useful to developers of the C++ part (this can only build the extensions
+in-place and does not support an install command).
+
+First change the working directory to the 'source' sub-directory then run make:
+
+cd source
+make
+
+this will build the orange core extensions in the root directory (i.e. the one you started in).
+Useful environment variables:
+
+ * PYTHON - names the python executable for which Orange is being build.
+ * CXXFLAGS - flags to pass to C++ compiler
+ * CFLAGS - flags to pass to C compiler
+ * LDFLAGS - flags to pass to the linker
+ * EXCLUDE_ORANGEQT - if set to any value will cause orangeqt to not be build 
+
+See source/orangeqt/README.txt for building orangeqt alone.
+
+== Linking to external libraries  ==
+
+The Orange source includes some third party libraries that are statically linked 
+into Orange by default:
+
+ * BLAS (a subset)
+ * LIBSVM (v3.2 - v3.* is required)
+ * LIBLINEAR (v1.8)
+ * QHull
+
+To customize the build process to link to the corresponding external library instead, try. 
+
+* For the setup.py method modify the setup-site.cfg file.
+
+* For make, pass the library names on the command line or through environment variables (listed
+in source/Makefile). Example:
+
+make BLAS_LIB=atlas
+

File Orange/utils/__init__.py

 printVerbose = deprecated_function_name(print_verbose)
 
 import urllib2
+import posixpath
+import os
+
+from contextlib import contextmanager
+import StringIO
+
+@contextmanager
+def finishing(obj):
+    """ Calls obj.finish() on context exit.
+    """
+    yield obj
+    obj.finish()
+
+def guess_size(fileobj):
+    try:
+        if isinstance(fileobj, file):
+            return os.fstat(fileobj.fileno()).st_size
+        elif isinstance(fileobj, StringIO.StringIO):
+            pos = fileobj.tell()
+            fileobj.seek(0, 2)
+            length = fileobj.tell() - pos
+            fileobj.seek(pos, 0)
+            return length
+        elif isinstance(fileobj, urllib.addinfourl):
+            length = fileobj.headers.get("content-length", None)
+            return length
+    except Exception, ex:
+        pass
 
 def copyfileobj(src, dst, buffer=2**10, content_len=None, progress=None):
     """