Ver Fonte

fix installer and imports

oz123 há 10 anos atrás
pai
commit
12d945df07
5 ficheiros alterados com 22 adições e 38 exclusões
  1. 1 1
      pwman/__init__.py
  2. 3 1
      pwman/data/factory.py
  3. 0 32
      pwman/ui/__init__.py
  4. 14 1
      scripts/pwman3
  5. 4 3
      setup.py

+ 1 - 1
pwman/__init__.py

@@ -24,7 +24,7 @@ import argparse
 import sys
 import re
 import colorama
-from .util import config
+from pwman.util import config
 from pwman.data import factory
 
 appname = "pwman3"

+ 3 - 1
pwman/data/factory.py

@@ -38,12 +38,14 @@ else:
 
 import os
 
-from pwman.data.database import DatabaseException
+from pwman.data.database import DatabaseException, __DB_FORMAT__
 from pwman.data.drivers import sqlite
 from pwman.data.drivers import postgresql
 
 
 def check_db_version(dburi):
+
+    ver = str(__DB_FORMAT__)
     dburi = urlparse(dburi)
     dbtype = dburi.scheme
     filename = os.path.abspath(dburi.path)

+ 0 - 32
pwman/ui/__init__.py

@@ -1,32 +0,0 @@
-# ============================================================================
-# This file is part of Pwman3.
-#
-# Pwman3 is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License, version 2
-# as published by the Free Software Foundation;
-#
-# Pwman3 is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with Pwman3; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-# ============================================================================
-# Copyright (C) 2012 Oz Nahum <nahumoz@gmail.com>
-# ============================================================================
-
-
-def get_ui_platform(platform):
-    if 'darwin' in platform:
-        from .mac import PwmanCliMac as PwmanCli
-        OSX = True
-    elif 'win' in platform:
-        from .win import PwmanCliWin as PwmanCli
-        OSX = False
-    else:
-        from .cli import PwmanCli
-        OSX = False
-
-    return PwmanCli, OSX

+ 14 - 1
scripts/pwman3

@@ -23,7 +23,6 @@ from __future__ import print_function
 import sys
 from pwman import get_conf_options, get_db_version
 from pwman import parser_options
-from pwman.ui import get_ui_platform
 from pwman.ui.tools import CLICallback
 import pwman.data.factory
 from pwman.exchange.importer import Importer
@@ -33,6 +32,20 @@ if sys.version_info.major > 2:
     raw_input = input
 
 
+def get_ui_platform(platform):  # pragma: no cover
+    if 'darwin' in platform:
+        from pwman.ui.mac import PwmanCliMac as PwmanCli
+        OSX = True
+    elif 'win' in platform:
+        from pwman.ui.win import PwmanCliWin as PwmanCli
+        OSX = False
+    else:
+        from pwman.ui.cli import PwmanCli
+        OSX = False
+
+    return PwmanCli, OSX
+
+
 def main(args):
     PwmanCli, OSX = get_ui_platform(sys.platform)
     xselpath, dbtype, config = get_conf_options(args, OSX)

+ 4 - 3
setup.py

@@ -9,6 +9,7 @@ from distutils.errors import DistutilsOptionError
 from distutils.command.build import build
 import argparse
 from setuptools import setup
+from setuptools import find_packages
 import sys
 from setuptools.command.install import install
 import os
@@ -340,9 +341,9 @@ setup(name=pwman.appname,
       author_email=pwman.authoremail,
       url=pwman.website,
       license="GNU GPL",
-      packages=['pwman'],
-      package_data={"data": ["documentation"]},
-      include_package_data=True,
+      packages=find_packages(exclude=['tests']),
+      #package_data={"data": ["docs"]},
+      #include_package_data=True,
       scripts=['scripts/pwman3'],
       zip_safe=False,
       install_requires=['pycrypto>=2.6',