Skip to content

Commit

Permalink
Revised pip resolution. Updated docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
BuvinJ committed Jan 19, 2019
1 parent e6f1bc3 commit a853cd5
Show file tree
Hide file tree
Showing 8 changed files with 94 additions and 52 deletions.
10 changes: 4 additions & 6 deletions distbuilder/pip_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
from distbuilder.util import * # @UnusedWildImport
from distbuilder.opy_library import obfuscatePyLib, OBFUS_DIR_PATH

__pipName = "pip"
__p = util._pythonScriptsPath( __pipName )
PIP_PATH = __p if exists( __p ) else __pipName
PIP_CMD_BASE = '"' + PYTHON_PATH + '" -m pip'

PIP_INSTALL = "install"
PIP_UNINSTALL = "uninstall"
Expand Down Expand Up @@ -33,7 +31,7 @@ def __init__( self
, isCacheUsed = True
, isUpgrade = False
, otherPipArgs = "" ) :
self.pipPath = PIP_PATH
self.pipCmdBase = PIP_CMD_BASE
self.source = source
self.version = version
self.verEquality = verEquality
Expand Down Expand Up @@ -102,15 +100,15 @@ def installLibrary( name, opyConfig=None, pipConfig=None ):
pipConfig.source = None

util._system( __PIP_INSTALL_TMPLT %
( pipConfig.pipPath, PIP_INSTALL, str(pipConfig) ), wrkDir )
( pipConfig.pipCmdBase, PIP_INSTALL, str(pipConfig) ), wrkDir )

# Discard temp files
if( opyConfig is not None and
exists( OBFUS_DIR_PATH ) ):
removeDir( OBFUS_DIR_PATH )

def uninstallLibrary( name ):
util._system( __PIP_UNINSTALL_TMPLT % ( PIP_PATH, PIP_UNINSTALL, name ) )
util._system( __PIP_UNINSTALL_TMPLT % ( PIP_CMD_BASE, PIP_UNINSTALL, name ) )

#https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs
#https://pip.pypa.io/en/stable/reference/pip_install/#vcs-support
Expand Down
2 changes: 1 addition & 1 deletion docs/Contribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
If you wish to report bugs, make request features, or contribute to this
project, please [join GitHub](https://github.com/join).

## Post Issue
## Post An Issue

Once you have a GitHub account, you can [post an issue](https://github.com/BuvinJT/distbuilder/issues)
for this project.
Expand Down
43 changes: 43 additions & 0 deletions docs/Issues.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Troubleshooting
![distbuilder logo](https://raw.githubusercontent.com/BuvinJT/distbuilder/master/docs/img/distbuilder128.png)

## Tested On

Python
- 2.7
- 3.5
- 3.7

Windows
- 8.0
- 10

macOS
- Sierra

Linux
- Ubuntu 16.04
- Ubuntu 18.04

## Qt Installer Framework issues

### Setting `QT_IFW_DIR`

TODO

### Windows: Launch App at end of install failures

TODO

### Windows 8 (and earlier?): Crash at end of install

Recent versions of QtIFW have been observed to crash at the
end of the installation on Windows 8. This bug has been
reported to Qt and they are supposed to be patching it.

The current work around is to directly launch the installer
with elevated priviledges (i.e as an administrator).

## Get Help

Refer to [Post An Issue](Contribute.md#post-an-issue).
76 changes: 37 additions & 39 deletions docs/QuickStart.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,23 @@

## Pre-Requisites

### Pip

Both the distbuilder installation, and the use of some features within it, require [pip](https://docs.python.org/3/installing/index.html). More than likley, you already have that installed. If not, note that installation process may be slightly different based on your platform or environmental details (e.g. having multiple Python installations). The scope of such matters is beyond what can be addressed here. Refer to these links as a starting point:

[Pip on Windows](https://stackoverflow.com/questions/4750806/how-do-i-install-pip-on-windows)

[Pip on Mac](https://stackoverflow.com/questions/17271319/how-do-i-install-pip-on-macos-or-os-x)

[Pip on Linux](https://stackoverflow.com/questions/6587507/how-to-install-pip-with-python-3)

### Opy

This library requires a fork from the open source project
"Opy", dubbed "Opy for Distribution Builder". When installing
distbuilder via the "natural" method of using `pip`, this
dependency will be **automatically installed**. If using an
alternate, less automated method, that library can be
acquired instead from:
distbuilder, this dependency should be **automatically installed**
for you. To aquire the source for that directly, and manually install
it, you may use the links/urls below:

[Opy for Distribution Builder](https://github.com/QQuick/Opy/tree/opy_distbuilder)

Expand All @@ -29,67 +38,56 @@ accessible via:

Additionally, the "Qt Installer Framework"
is recommended. This component is not a hard
requirement, but is strongly recommended, so
that you may employ the distbuilder installation
building features.
requirement, but is *strongly recommended*, so
that you may employ the distbuilder installer
creation features.

QtIFW can be acquired from: [QtIFW Downloads](http://download.qt.io/official_releases/qt-installer-framework)

Once installed, the best way to integrate it
with distbuilder is to define an environmental
variable name `QT_IFW_DIR` and the set value
for that equal to the directory where you
installed the utility. Refer to the
[Installers](Reference.md#installers) section of
the [Reference Manual](Reference.md#installers) for
more details.
installed the utility. Note, it also possible to
supply the path within your implemenation script.
Refer to the [Installers](Reference.md#installers) section of
the Reference Manual for details.

## Installation

Normally, installation is as simple as executing the following
Standard installation is as simple as executing the following
on your terminal / command prompt:

pip install distbuilder
python -m pip install distbuilder

To install from the raw source instead, you may perform a
Git clone from `https://github.com/BuvinJT/distbuilder.git`,
or otherwise download the repository from the
[GitHub](https://github.com/BuvinJT/distbuilder) page.


With you local copy of the source, on Windows you may
With a local copy of the full source, on Windows you may
simply run `install.bat` (or `install3.bat`).
On Mac or Linux, you may use the counterpart `install.sh`
(or `install3.sh`) instead.

If you encounter failures with those scripts, try
this "manual" approach. From a command line interface,
change to the directory containing this repo, then execute:

pip install .

(Don't miss the period at the end!)

Or, if that doesn't work for some reason, try:
change to the directory containing the source, then execute:

python -m pip install .

Finally, as a last resort, if you don't have pip
installed for some reason, you can use this:

python setup.py install

(Don't miss the period at the end!)

## Use Overview
## Implementation Overview

The standard way the library was intended for use is to
add a `build.py` script to the root directory of the
project you wish to distribute. (Note: the file may have
any name of your choice - "build.py" is merely a
recommended naming convention). After defining that
script, you run it to build your distribution package.
script, you simply run it to build your distribution package.

In `build.py`, you may wish to simply import everything
In `build.py`, you may wish to import everything
from this library via `import distbuilder *`. If
your build script will use the "low level functions" offered
by the library, starting it in that manner is often a
Expand All @@ -106,21 +104,21 @@ library be installed.*

The easiest way learn how to use distbuilder is likely
to reference an example. The "Hello World Tk Example"
is include in the "source distribution" of the library.
is included in the "source distribution" of the library.
You may visit the [PyPi](https://pypi.org/project/distbuilder/#files)
downloads page for the project to acquire this.
downloads page for the project to acquire this in the form of a tarball.

Alternatively, you may download/copy the source files directly from GitHub into a local directory:
Alternatively, you may download/copy these example files directly from GitHub into a local directory:

[hello.py](https://raw.githubusercontent.com/BuvinJT/distbuilder/master/examples/hello_world_tk/hello.py)
Example app: [hello.py](https://raw.githubusercontent.com/BuvinJT/distbuilder/master/examples/hello_world_tk/hello.py)

[build.py](https://raw.githubusercontent.com/BuvinJT/distbuilder/master/examples/hello_world_tk/build.py)
Build script: [build.py](https://raw.githubusercontent.com/BuvinJT/distbuilder/master/examples/hello_world_tk/build.py)

Windows: [demo.ico](https://raw.githubusercontent.com/BuvinJT/distbuilder/master/examples/hello_world_tk/demo.ico)
Windows resource: [demo.ico](https://raw.githubusercontent.com/BuvinJT/distbuilder/master/examples/hello_world_tk/demo.ico)

Mac: [demo.icns](https://raw.githubusercontent.com/BuvinJT/distbuilder/master/examples/hello_world_tk/demo.icns)
Mac resource: [demo.icns](https://raw.githubusercontent.com/BuvinJT/distbuilder/master/examples/hello_world_tk/demo.icns)

Linux: [demo.png](https://raw.githubusercontent.com/BuvinJT/distbuilder/master/examples/hello_world_tk/demo.png)
Linux resource: [demo.png](https://raw.githubusercontent.com/BuvinJT/distbuilder/master/examples/hello_world_tk/demo.png)

Start by confirming you can run the program
script in the "natural" manner:
Expand Down Expand Up @@ -159,7 +157,7 @@ messages produced by gui applications. This may be counterproductive
for debugging though, and as such distbuilder provides a
direct "solution" for this issue. Refer to the
[Testing](Reference.md#testing) section of the
[Reference Manual](Reference.md#installers) for more details.
Reference Manual for more details.

## Learn More

Expand Down
2 changes: 1 addition & 1 deletion docs/Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ Constructor:

Attributes:

pipPath = "pip" (i.e. on the system path)
pipCmdBase = "[PYTHON BINARY PATH]" -m pip
source
version
verEquality
Expand Down
7 changes: 4 additions & 3 deletions docs/ToDo.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@

## High Priority

* Test on platforms other than Windows!
(should work in theory, but confirmation required)

* Add additional examples.

* Continue to expand upon the documentation, especially with
Expand All @@ -27,6 +24,10 @@ divisions.

* Continue to improve and stablize the Opy library and its beta features.

* Test on latest macOS

* Test on more Linux distros

## Low Priority

* Add the options to build projects outside of the project directory.
Expand Down
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pages:
- Home: index.md
- Quick Start Guide: QuickStart.md
- Reference Manual: Reference.md
- Troubleshooting: Issues.md
- To-Do List: ToDo.md
- Contact / Contribute: Contribute.md
theme: readthedocs
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from setuptools import setup

# Override standard setutools commands.
# Override standard setuptools commands.
# Enforce the order of dependency installation
#-------------------------------------------------
PREREQS = [ "six" ]
Expand Down Expand Up @@ -70,7 +70,8 @@ def run( self ):
],
packages = ["distbuilder"],
install_requires = [
"PyInstaller" # Tested on PyInstaller v3.4
"six" # Forced as prerequisite too
, "PyInstaller" # Tested on PyInstaller v3.4
, "opy_distbuilder"
],
include_package_data=True, # extra files defined in MANIFEST.in
Expand Down

0 comments on commit a853cd5

Please sign in to comment.