Skip to content

Commit

Permalink
Restructure for PyPi
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedro Worcel committed Dec 23, 2014
1 parent 3458cde commit 9c503e4
Show file tree
Hide file tree
Showing 75 changed files with 95 additions and 26 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
*.pyc
.update-workspace/
droopescan.egg-info/
dist/
.pypirc
build/
2 changes: 2 additions & 0 deletions .todo.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
Add;

- https://hynek.me/articles/sharing-your-labor-of-love-pypi-quick-and-dirty/

Version 1.x:

- Add automatic plugin & theme list generation for SS & Drupal.
Expand Down
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@ language: python
python:
- "2.7"
- "3.2"
- "3.3"
- "3.4"
before_install:
- sudo apt-get update -qq
- sudo apt-get install -y -qq python-dev libxslt1-dev libxml2-dev
install:
- "pip install -r requirements.txt"
- "pip install -r requirements_test.txt"
script: nosetests --exclude integration_tests
- "export PYTHONPATH=$PYTHONPATH:."
- "cd ./dscan/"
script: nosetests
notifications:
email: false

Expand Down
6 changes: 6 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
include *.md
include *.txt
include .travis.yml
include CHANGELOG
include LICENSE
recursive-include dscan *
1 change: 1 addition & 0 deletions README.txt
1 change: 0 additions & 1 deletion droopescan

This file was deleted.

9 changes: 9 additions & 0 deletions droopescan
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env python
import dscan, sys, os

p = os.path.dirname(dscan.__file__)
sys.path.append(p)
os.chdir(p)

import droopescan
droopescan.main()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion droopescan.py → dscan/droopescan.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Meta:
label = 'droopescan'
base_controller = DroopeScanBase

if __name__ == "__main__":
def main():
ds = DroopeScan("DroopeScan",
plugin_config_dir="./plugins.d",
plugin_dir="./plugins",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
29 changes: 16 additions & 13 deletions plugins/release.py → dscan/plugins/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from distutils.util import strtobool
from plugins import HumanBasePlugin
from subprocess import call
import re
import sys, tempfile, os

CHANGELOG = 'CHANGELOG'
Expand Down Expand Up @@ -81,22 +82,24 @@ def release(self):
if ok:
self.prepend_to_file(CHANGELOG, final)

# Commit changelog.
call(['git', 'add', '.'])
call(['git', 'commit', '-m', 'Tagging version \'%s\'' %
version_nb])
try:
call(['git', 'add', '.'])
call(['git', 'commit', '-m', 'Tagging version \'%s\'' %
version_nb])

# Merge stable changes to master.
call(['git', 'checkout', 'master'])
call(['git', 'merge', 'development'])
call(['git', 'checkout', 'master'])
call(['git', 'merge', 'development'])

# Tag & push.
call(['git', 'tag', version_nb])
call('git remote | xargs -l git push --all', shell=True)
call('git remote | xargs -l git push --tags', shell=True)
call(['git', 'tag', version_nb])
call('git remote | xargs -l git push --all', shell=True)
call('git remote | xargs -l git push --tags', shell=True)

# Return to development.
call(['git', 'checkout', 'development'])
is_final_release = '^[0-9.]*$'
if re.match(is_final_release, version_nb):
call(['python', 'setup.py', 'sdist', 'upload', '-r', 'pypi'])
call(['python', 'setup.py', 'bdist_wheel', 'upload', '-r', 'pypi'])
finally:
call(['git', 'checkout', 'development'])

else:
self.error('Canceled by user')
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 4 additions & 6 deletions plugins/tests.py → dscan/plugins/tests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from cement.core import handler, controller
from plugins import HumanBasePlugin
from subprocess import call
import os, sys

BASE_FOLDER = '/var/www/drupal/'
UPDATE_MAJOR = ['6', '7']
Expand All @@ -12,14 +13,11 @@ class Meta:
stacked_type = 'nested'
hide = True

arguments = [
(['--integration', '-i'], dict(action='store_true', help='')),
]

@controller.expose(help='', hide=True)
def default(self):
call(['python2', '/usr/local/bin/nosetests'])
call(['python3', '/usr/local/bin/nosetests'])
env = {'PYTHONPATH': os.getcwd()}
call(['python2', '/usr/local/bin/nosetests'], env=env)
call(['python3', '/usr/local/bin/nosetests'], env=env)

def load():
handler.register(Tests)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 3 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cement==2.2.2
requests==2.3.0
pystache==0.5.4
futures==2.1.6
--index-url https://pypi.python.org/simple/

-e .
3 changes: 3 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[wheel]
universal = 1

41 changes: 41 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import os
from setuptools import setup, find_packages

def read(*paths):
with open(os.path.join(*paths), 'r') as f:
return f.read()

def read_first_line(f):
with open(f, 'r') as f:
first_line = f.readline()

return first_line.strip()


setup(
name='droopescan',
version=read_first_line('CHANGELOG'),
description='A plugin-based scanner that aids security researchers in identifying issues with several CMSs, mainly Drupal & Silverstripe.',
author_email='[email protected]',
author='Pedro Worcel',
include_package_data=True,
license='GPL',
long_description=(read('CHANGELOG')),
packages=find_packages('.', exclude='tests'),
url='http://github.com/droope/droopescan/',
scripts=['droopescan'],
classifiers=[
'Development Status :: 5 - Production/Stable',
'License :: OSI Approved :: GNU General Public License (GPL)',
'Operating System :: Unix',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
],
install_requires=[
'cement>=2.2,<2.2.99',
'requests',
'pystache',
'futures'
],
)

0 comments on commit 9c503e4

Please sign in to comment.