[pkg] packaging and path changes
authorKali Kaneko <kali@leap.se>
Tue, 25 Jul 2017 15:40:11 +0000 (11:40 -0400)
committerKali Kaneko <kali@leap.se>
Tue, 25 Jul 2017 15:40:29 +0000 (11:40 -0400)
- move all the pixelated python package under src/
- move the pixelated_www package under the leap namespace
- allow to set globally the static folder
- add hours and minutes to the timestamp in package version, to allow
  for several releases a day.

94 files changed:
.gitignore
service/pixelated/__init__.py [deleted file]
service/setup.py
service/src/pixelated/__init__.py [moved from web-ui/pixelated_www/__init__.py with 100% similarity]
service/src/pixelated/account_recovery.py [moved from service/pixelated/account_recovery.py with 100% similarity]
service/src/pixelated/adapter/__init__.py [moved from service/pixelated/adapter/services/__init__.py with 100% similarity]
service/src/pixelated/adapter/listeners/__init__.py [moved from service/pixelated/adapter/model/__init__.py with 100% similarity]
service/src/pixelated/adapter/listeners/mailbox_indexer_listener.py [moved from service/pixelated/adapter/listeners/mailbox_indexer_listener.py with 100% similarity]
service/src/pixelated/adapter/mailstore/__init__.py [moved from service/pixelated/adapter/mailstore/__init__.py with 100% similarity]
service/src/pixelated/adapter/mailstore/body_parser.py [moved from service/pixelated/adapter/mailstore/body_parser.py with 100% similarity]
service/src/pixelated/adapter/mailstore/leap_attachment_store.py [moved from service/pixelated/adapter/mailstore/leap_attachment_store.py with 100% similarity]
service/src/pixelated/adapter/mailstore/leap_mailstore.py [moved from service/pixelated/adapter/mailstore/leap_mailstore.py with 100% similarity]
service/src/pixelated/adapter/mailstore/mailstore.py [moved from service/pixelated/adapter/mailstore/mailstore.py with 100% similarity]
service/src/pixelated/adapter/mailstore/maintenance/__init__.py [moved from service/pixelated/adapter/mailstore/maintenance/__init__.py with 100% similarity]
service/src/pixelated/adapter/mailstore/searchable_mailstore.py [moved from service/pixelated/adapter/mailstore/searchable_mailstore.py with 100% similarity]
service/src/pixelated/adapter/model/__init__.py [moved from service/pixelated/adapter/listeners/__init__.py with 100% similarity]
service/src/pixelated/adapter/model/mail.py [moved from service/pixelated/adapter/model/mail.py with 100% similarity]
service/src/pixelated/adapter/model/status.py [moved from service/pixelated/adapter/model/status.py with 100% similarity]
service/src/pixelated/adapter/model/tag.py [moved from service/pixelated/adapter/model/tag.py with 100% similarity]
service/src/pixelated/adapter/search/__init__.py [moved from service/pixelated/adapter/search/__init__.py with 100% similarity]
service/src/pixelated/adapter/search/contacts.py [moved from service/pixelated/adapter/search/contacts.py with 100% similarity]
service/src/pixelated/adapter/search/index_storage_key.py [moved from service/pixelated/adapter/search/index_storage_key.py with 100% similarity]
service/src/pixelated/adapter/services/__init__.py [moved from service/pixelated/adapter/__init__.py with 100% similarity]
service/src/pixelated/adapter/services/draft_service.py [moved from service/pixelated/adapter/services/draft_service.py with 100% similarity]
service/src/pixelated/adapter/services/feedback_service.py [moved from service/pixelated/adapter/services/feedback_service.py with 100% similarity]
service/src/pixelated/adapter/services/mail_sender.py [moved from service/pixelated/adapter/services/mail_sender.py with 100% similarity]
service/src/pixelated/adapter/services/mail_service.py [moved from service/pixelated/adapter/services/mail_service.py with 100% similarity]
service/src/pixelated/adapter/services/tag_service.py [moved from service/pixelated/adapter/services/tag_service.py with 100% similarity]
service/src/pixelated/adapter/welcome_mail.py [moved from service/pixelated/adapter/welcome_mail.py with 100% similarity]
service/src/pixelated/application.py [moved from service/pixelated/application.py with 100% similarity]
service/src/pixelated/assets/__init__.py [moved from service/pixelated/extensions/__init__.py with 100% similarity]
service/src/pixelated/assets/recovery.mail.en-US [moved from service/pixelated/assets/recovery.mail.en-US with 100% similarity]
service/src/pixelated/assets/recovery.mail.pt-BR [moved from service/pixelated/assets/recovery.mail.pt-BR with 100% similarity]
service/src/pixelated/assets/welcome.mail.en-US [moved from service/pixelated/assets/welcome.mail.en-US with 100% similarity]
service/src/pixelated/assets/welcome.mail.pt-BR [moved from service/pixelated/assets/welcome.mail.pt-BR with 100% similarity]
service/src/pixelated/assets/welcome.mail.pt-BR.txt [moved from service/pixelated/assets/welcome.mail.pt-BR.txt with 100% similarity]
service/src/pixelated/authentication.py [moved from service/pixelated/authentication.py with 100% similarity]
service/src/pixelated/bitmask_libraries/__init__.py [moved from service/pixelated/config/__init__.py with 100% similarity]
service/src/pixelated/bitmask_libraries/certs.py [moved from service/pixelated/bitmask_libraries/certs.py with 100% similarity]
service/src/pixelated/bitmask_libraries/keymanager.py [moved from service/pixelated/bitmask_libraries/keymanager.py with 100% similarity]
service/src/pixelated/bitmask_libraries/provider.py [moved from service/pixelated/bitmask_libraries/provider.py with 100% similarity]
service/src/pixelated/bitmask_libraries/smtp.py [moved from service/pixelated/bitmask_libraries/smtp.py with 100% similarity]
service/src/pixelated/certificates/__init__.py [moved from service/pixelated/certificates/__init__.py with 100% similarity]
service/src/pixelated/certificates/unstable.pixelated-project.org.ca.crt [moved from service/pixelated/certificates/unstable.pixelated-project.org.ca.crt with 100% similarity]
service/src/pixelated/config/__init__.py [moved from service/pixelated/bitmask_libraries/__init__.py with 100% similarity]
service/src/pixelated/config/arguments.py [moved from service/pixelated/config/arguments.py with 100% similarity]
service/src/pixelated/config/credentials.py [moved from service/pixelated/config/credentials.py with 100% similarity]
service/src/pixelated/config/leap.py [moved from service/pixelated/config/leap.py with 100% similarity]
service/src/pixelated/config/leap_config.py [moved from service/pixelated/config/leap_config.py with 100% similarity]
service/src/pixelated/config/logger.py [moved from service/pixelated/config/logger.py with 100% similarity]
service/src/pixelated/config/services.py [moved from service/pixelated/config/services.py with 100% similarity]
service/src/pixelated/config/sessions.py [moved from service/pixelated/config/sessions.py with 100% similarity]
service/src/pixelated/config/site.py [moved from service/pixelated/config/site.py with 100% similarity]
service/src/pixelated/extensions/__init__.py [moved from service/pixelated/assets/__init__.py with 100% similarity]
service/src/pixelated/extensions/esmtp_sender_factory.py [moved from service/pixelated/extensions/esmtp_sender_factory.py with 100% similarity]
service/src/pixelated/extensions/protobuf_socket.py [moved from service/pixelated/extensions/protobuf_socket.py with 100% similarity]
service/src/pixelated/extensions/requests_urllib3.py [moved from service/pixelated/extensions/requests_urllib3.py with 100% similarity]
service/src/pixelated/extensions/sqlcipher_wal.py [moved from service/pixelated/extensions/sqlcipher_wal.py with 100% similarity]
service/src/pixelated/maintenance.py [moved from service/pixelated/maintenance.py with 100% similarity]
service/src/pixelated/register.py [moved from service/pixelated/register.py with 100% similarity]
service/src/pixelated/resources/__init__.py [moved from service/pixelated/resources/__init__.py with 91% similarity]
service/src/pixelated/resources/account_recovery_resource.py [moved from service/pixelated/resources/account_recovery_resource.py with 100% similarity]
service/src/pixelated/resources/attachments_resource.py [moved from service/pixelated/resources/attachments_resource.py with 100% similarity]
service/src/pixelated/resources/auth.py [moved from service/pixelated/resources/auth.py with 100% similarity]
service/src/pixelated/resources/backup_account_resource.py [moved from service/pixelated/resources/backup_account_resource.py with 100% similarity]
service/src/pixelated/resources/contacts_resource.py [moved from service/pixelated/resources/contacts_resource.py with 100% similarity]
service/src/pixelated/resources/features_resource.py [moved from service/pixelated/resources/features_resource.py with 100% similarity]
service/src/pixelated/resources/feedback_resource.py [moved from service/pixelated/resources/feedback_resource.py with 100% similarity]
service/src/pixelated/resources/keys_resource.py [moved from service/pixelated/resources/keys_resource.py with 100% similarity]
service/src/pixelated/resources/login_resource.py [moved from service/pixelated/resources/login_resource.py with 100% similarity]
service/src/pixelated/resources/logout_resource.py [moved from service/pixelated/resources/logout_resource.py with 100% similarity]
service/src/pixelated/resources/mail_resource.py [moved from service/pixelated/resources/mail_resource.py with 100% similarity]
service/src/pixelated/resources/mails_resource.py [moved from service/pixelated/resources/mails_resource.py with 100% similarity]
service/src/pixelated/resources/root_resource.py [moved from service/pixelated/resources/root_resource.py with 100% similarity]
service/src/pixelated/resources/sandbox_resource.py [moved from service/pixelated/resources/sandbox_resource.py with 100% similarity]
service/src/pixelated/resources/session.py [moved from service/pixelated/resources/session.py with 100% similarity]
service/src/pixelated/resources/tags_resource.py [moved from service/pixelated/resources/tags_resource.py with 100% similarity]
service/src/pixelated/resources/user_settings_resource.py [moved from service/pixelated/resources/user_settings_resource.py with 100% similarity]
service/src/pixelated/resources/users.py [moved from service/pixelated/resources/users.py with 100% similarity]
service/src/pixelated/support/__init__.py [moved from service/pixelated/support/__init__.py with 100% similarity]
service/src/pixelated/support/clock.py [moved from service/pixelated/support/clock.py with 100% similarity]
service/src/pixelated/support/date.py [moved from service/pixelated/support/date.py with 100% similarity]
service/src/pixelated/support/encrypted_file_storage.py [moved from service/pixelated/support/encrypted_file_storage.py with 100% similarity]
service/src/pixelated/support/error_handler.py [moved from service/pixelated/support/error_handler.py with 100% similarity]
service/src/pixelated/support/functional.py [moved from service/pixelated/support/functional.py with 100% similarity]
service/src/pixelated/support/language.py [moved from service/pixelated/support/language.py with 100% similarity]
service/src/pixelated/support/loglinegenerator.py [moved from service/pixelated/support/loglinegenerator.py with 100% similarity]
service/src/pixelated/support/mail_generator.py [moved from service/pixelated/support/mail_generator.py with 100% similarity]
service/src/pixelated/support/markov.py [moved from service/pixelated/support/markov.py with 100% similarity]
service/src/pixelated/support/replier.py [moved from service/pixelated/support/replier.py with 100% similarity]
service/src/pixelated/support/tls_adapter.py [moved from service/pixelated/support/tls_adapter.py with 100% similarity]
web-ui/Makefile
web-ui/leap/__init__.py [new file with mode: 0644]
web-ui/setup.py

index 392a831..01551d8 100644 (file)
@@ -38,6 +38,6 @@ _trial_temp
 web-ui/coverage
 .nyc_output
 web-ui/npm-debug.log.*
-web-ui/pixelated_www/*
+web-ui/leap/pixelated_www/*
 web-ui/build/*
 !web-ui/pixelated_www/__init__.py
diff --git a/service/pixelated/__init__.py b/service/pixelated/__init__.py
deleted file mode 100644 (file)
index e69de29..0000000
index 09c2195..fa2e0c4 100644 (file)
 
 import datetime
 import os
-from setuptools import setup
+from setuptools import setup, find_packages
 import time
 
 now = datetime.datetime.now()
-timestamp = time.strftime('%Y%m%d', now.timetuple())
+timestamp = time.strftime('%Y%m%d%H%M', now.timetuple())
 
 
 def read(fname):
     return open(os.path.join(os.path.dirname(__file__), fname)).read()
 
+required = [
+    'requests',  # TODO deprecate!!!
+    'pyasn1',
+    'whoosh',
+    'twisted']
 
 setup(name='leap.pixelated',
-      version='1,0beta2.%s' % timestamp,
+      version='1.0.%s' % timestamp,
       description='Twisted API with a RESTful service for the Pixelated front-end.',
       long_description=read('README.md'),
       author='LEAP Encryption Access Project',
       author_email='info@leap.se',
       url='https://github.com/leapcode/pixelated-user-agent',
-      packages=[
-          'pixelated',
-          'pixelated.adapter',
-          'pixelated.adapter.listeners',
-          'pixelated.adapter.model',
-          'pixelated.adapter.search',
-          'pixelated.adapter.services',
-          'pixelated.adapter.mailstore',
-          'pixelated.adapter.mailstore.maintenance',
-          'pixelated.bitmask_libraries',
-          'pixelated.config',
-          'pixelated.assets',
-          'pixelated.certificates',
-          'pixelated.support',
-          'pixelated.resources',
-          'pixelated.extensions'
-      ],
-      install_requires=[],
-      entry_points={
-          'console_scripts': [
-              'pixelated-user-agent = pixelated.application:initialize',
-              'pixelated-maintenance = pixelated.maintenance:initialize',
-              'pixelated-register = pixelated.register:initialize'
-          ]
-      },
+      license='GNU Affero General Public License v3 or later (AGPLv3+)',
+      package_dir={'': 'src'},
+      packages=find_packages('src'),
+      install_requires=required,
       include_package_data=True)
similarity index 91%
rename from service/pixelated/resources/__init__.py
rename to service/src/pixelated/resources/__init__.py
index 9dae4a6..58b5678 100644 (file)
@@ -28,6 +28,9 @@ from twisted.web.http import INTERNAL_SERVER_ERROR, SERVICE_UNAVAILABLE
 log = Logger()
 
 
+STATIC = None
+
+
 class SetEncoder(json.JSONEncoder):
     def default(self, obj):
         if isinstance(obj, set):
@@ -57,6 +60,11 @@ def handle_error_deferred(e, request):
     request.finish()
 
 
+def set_static_folder(static_folder):
+    global STATIC
+    STATIC = static_folder
+
+
 def get_protected_static_folder(static_folder=None):
     static = static_folder or _get_static_folder()
     return os.path.join(static, 'protected')
@@ -68,9 +76,12 @@ def get_public_static_folder(static_folder=None):
 
 
 def _get_static_folder():
-    static_folder = os.path.abspath(os.path.join(os.path.abspath(__file__), "..", "..", "..", "..", "web-ui", "dist"))
-    if not os.path.exists(static_folder):
-        static_folder = os.path.join('/', 'usr', 'share', 'pixelated-user-agent')
+    if not STATIC:
+        static_folder = os.path.abspath(os.path.join(os.path.abspath(__file__), "..", "..", "..", "..", "web-ui", "dist"))
+        if not os.path.exists(static_folder):
+            static_folder = os.path.join('/', 'usr', 'share', 'pixelated-user-agent')
+    else:
+        static_folder = STATIC
     return static_folder
 
 
index 3ee83eb..4633a76 100644 (file)
@@ -36,7 +36,7 @@ pydist-clean: clean
 
 
 pydist-wheel:
-       cp -r dist/* pixelated_www/
+       cp -r dist/* leap/pixelated_www/
        python setup.py bdist_wheel
 
 
diff --git a/web-ui/leap/__init__.py b/web-ui/leap/__init__.py
new file mode 100644 (file)
index 0000000..f48ad10
--- /dev/null
@@ -0,0 +1,6 @@
+# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
+try:
+    __import__('pkg_resources').declare_namespace(__name__)
+except ImportError:
+    from pkgutil import extend_path
+    __path__ = extend_path(__path__, __name__)
index 2f1266f..fbf5142 100644 (file)
@@ -21,27 +21,19 @@ import datetime
 import time
 
 now = datetime.datetime.now()
-timestamp = time.strftime('%Y%m%d', now.timetuple())
+timestamp = time.strftime('%Y%m%d%H%M', now.timetuple())
 
 setup(name='leap.pixelated-www',
-      version='1.0beta2.%s' % timestamp,
+      version='1.0.%s' % timestamp,
       description='Static Assets for the Pixelated User Agent UI',
       author='LEAP Encryption Access Project',
       author_email='info@leap.se',
       url='http://github.com/leapcode/pixelated-user-agent',
+      license='GNU Affero General Public License v3 or later (AGPLv3+)',
       namespace_packages=['leap'],
-      packages=['pixelated_www'],
+      packages=['leap.pixelated_www'],
       package_data={
-          '': ['404.html',
-               'index.html',
-               'app.min.js',
-               'sandbox.html',
-               'sandbox.min.js',
-               'bower_components/jquery-file-upload/css/*',
-               'bower_components/font-awesome/css/*',
-               'bower_components/font-awesome/fonts/*',
-               'css/*',
-               'fonts/*',
-               'locales/en-us/*',
-               'locales/pt/*',
-               'locales/sv/*']})
+          '': ['protected/*',
+               'protected/css/*',
+               'protected/fonts/*',
+               'public/*']})