Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Codeq3105 #4

Open
wants to merge 4 commits into
base: v0.6
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ dist
docs/_*/*
docs/autodoc/
pyan/
build/scripts-2.7/
desktop/icons/
12 changes: 11 additions & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,14 @@ forums for instructions on how to create a package on OS X.
Please note that some versions of OS X don't work.

#### Windows
## TODO: Create Windows package creation instructions

Run `python setup.py bdist_wininst` and this will create an appropriate installer executable in `dist/`.

# Troubleshooting

## Working in a virtualenv
If you get the error about importing PyQt4 when using a virtualenv, run these commands (adjusted to suit your venv name and site-wide PyQt4 installation)

`ln -s /usr/lib/python2.7/dist-packages/PyQt4 ~/.virtualenvs/pybitmessage-devops/lib/python2.7/site-packages/`
`ln -s /usr/lib/python2.7/dist-packages/sip.x86_64-linux-gnu.so ~/.virtualenvs/pybitmessage-devops/lib/python2.7/site-packages/`

23 changes: 22 additions & 1 deletion PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,28 @@
### Tests

- If there has been a change to the code, there's a good possibility there should be a corresponding change to the tests
- If you can't run `fab tests` successfully, ask for someone to run it against your branch
- If you can't run `fab tests` successfully, ask for someone to run it against your branch. If you can't (and know that this fab task is not working yet), at least make sure the following commands work:

- Make sure the installer still works (this may be insufficient if files are deleted) and that the installed version
works.

- `python setup.py install --record files.txt; tr '\n' '\0' < files.txt | xargs -0 rm -f --; python setup.py install`
- `pybitmessage`

- And as root:

- `sudo python setup.py install --record files.txt; tr '\n' '\0' < files.txt | xargs -0 sudo rm -f --; sudo python setup.py install`
- `pybitmessage`

- Make sure the apps still work portably:

- `./src/bitmessagemain.py`
- `./src/bitmessagecli.py`

- Make sure the travis test still works (currently just `pybitmessage -t` but check travis.yml for changes

- Ideally, try this in a virtualenv, as a user with no venv, system-wide as root and on windows with `python setup.py bdist_wininst
; dist/Bitmessage_x64_0.6.3.2.exe` followed by uninstalling through add/remove progragrams and re-installing (actual filename may vary).

## Translations

Expand Down
33 changes: 26 additions & 7 deletions checkdeps.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python2
# pylint: disable=no-name-in-module,import-error; PyCQA/pylint/issues/73
"""
Check dependendies and give recommendations about how to satisfy them

Expand All @@ -10,9 +11,15 @@
EXTRAS_REQUIRE. This is fine because most developers do, too.
"""

from __future__ import print_function

import os
import sys
from distutils.errors import CompileError
from importlib import import_module

from src.depends import PACKAGE_MANAGER, PACKAGES, detectOS

try:
from setuptools.dist import Distribution
from setuptools.extension import Extension
Expand All @@ -24,10 +31,6 @@
HAVE_SETUPTOOLS = False
EXTRAS_REQUIRE = []

from importlib import import_module

from src.depends import detectOS, PACKAGES, PACKAGE_MANAGER


COMPILING = {
"Debian": "build-essential libssl-dev",
Expand All @@ -52,10 +55,23 @@
"Guix": [""],
"Gentoo": ["dev-python/python-prctl"],
},
'devops': {
"OpenBSD": [""],
"FreeBSD": [""],
"Debian": ["libncurses5-dev"],
"Ubuntu": [""],
"Ubuntu 12": [""],
"openSUSE": [""],
"Fedora": [""],
"Guix": [""],
"Gentoo": [""],
},

}


def detectPrereqs(missing=True):
"""Detect pre-requesits of PACKAGES from src.depends"""
available = []
for module in PACKAGES:
try:
Expand All @@ -69,6 +85,7 @@ def detectPrereqs(missing=True):


def prereqToPackages():
"""Detect OS-specific package depenedncies"""
if not detectPrereqs():
return
print("%s %s" % (
Expand All @@ -77,13 +94,15 @@ def prereqToPackages():


def compilerToPackages():
"""Detect OS-specific compiler packages"""
if not detectOS() in COMPILING:
return
print("%s %s" % (
PACKAGE_MANAGER[detectOS.result], COMPILING[detectOS.result]))


def testCompiler():
"""Test the compiler and dependencies"""
if not HAVE_SETUPTOOLS:
# silent, we can't test without setuptools
return True
Expand Down Expand Up @@ -140,9 +159,9 @@ def testCompiler():
if OPSYS is None:
break
if rhs and any([
EXTRAS_REQUIRE_DEPS[x][OPSYS]
for x in rhs
if x in EXTRAS_REQUIRE_DEPS
EXTRAS_REQUIRE_DEPS[x][OPSYS]
for x in rhs
if x in EXTRAS_REQUIRE_DEPS
]):
rhs_cmd = ''.join([
CMD,
Expand Down
Binary file added desktop/icons/24x24/pybitmessage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
149 changes: 149 additions & 0 deletions desktop/icons/scalable/pybitmessage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions fabfile/app_path.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""
app_path.py
===========

Since fabfile directories are not part of the project they can't see modules such as `version` to update the
documentation versioning for example.

"""

import os
import sys

app_dir = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'src')
sys.path.insert(0, app_dir)
28 changes: 24 additions & 4 deletions fabfile/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
"""

import os
import sys
import re
import sys
from functools import wraps

from fabric.api import run, hide, cd, env
from fabric.api import cd, env, hide, run
from fabric.context_managers import settings, shell_env
from fabvenv import virtualenv


FABRIC_ROOT = os.path.dirname(__file__)
PROJECT_ROOT = os.path.dirname(FABRIC_ROOT)
VENV_ROOT = os.path.expanduser(os.path.join('~', '.virtualenvs', 'pybitmessage-devops'))
Expand Down Expand Up @@ -80,7 +79,12 @@ def filelist_from_git(rev=None):
clean = re.sub('\n', '', clean)
for line in clean.split('\r'):
if line.endswith(".py"):
results.append(os.path.abspath(line))
with settings(warn_only=True):
with hide('warnings'):
if run('stat {}'.format(os.path.abspath(line))).succeeded:
results.append(os.path.abspath(line))
else:
print 'Deleted file {} skipped.'.format(line)
return results


Expand Down Expand Up @@ -133,6 +137,22 @@ def pylint(path_to_file):
)


def isort(path_to_file):
"""Run isort on a file"""
with virtualenv(VENV_ROOT):
with hide('warnings', 'running', 'stdout', 'stderr'):
with settings(warn_only=True):
with shell_env(PYTHONPATH=PYTHONPATH):
returnable = run(
'isort {0}'.format(
path_to_file,
),
)
# isort takes the view that a sorted file in is an error
returnable.return_code = not returnable.return_code
return returnable


def autopep8(path_to_file):
"""Run autopep8 on a file"""
with virtualenv(VENV_ROOT):
Expand Down
9 changes: 0 additions & 9 deletions fabfile/requirements.txt

This file was deleted.

Loading