Initial commit
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
new file mode 100644
index 0000000..fa4f054
--- /dev/null
+++ b/CHANGELOG.rst
@@ -0,0 +1,9 @@
+
+==============
+python-formula
+==============
+
+0.0.1
+-----
+
+- Initial state of Python environment
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..8e80b12
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,13 @@
+Copyright (c) 2014-2015 tcp cloud a. s.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
\ No newline at end of file
diff --git a/README.rst b/README.rst
new file mode 100644
index 0000000..a82b793
--- /dev/null
+++ b/README.rst
@@ -0,0 +1,81 @@
+
+======
+Python
+======
+
+Python is a widely used general-purpose, high-level programming language. Its design philosophy emphasizes code readability, and its syntax allows programmers to express concepts in fewer lines of code than would be possible in languages such as C++ or Java. The language provides constructs intended to enable clear programs on both a small and large scale.
+
+Python supports multiple programming paradigms, including object-oriented, imperative and functional programming or procedural styles. It features a dynamic type system and automatic memory management and has a large and comprehensive standard library.
+
+Available states
+================
+
+.. contents::
+ :local:
+
+``python``
+----------
+
+Install defined packages.
+
+``python.environment``
+----------------------
+
+Also install defined packages.
+
+Available metadata
+==================
+
+.. contents::
+ :local:
+
+``service.environment``
+-----------------------
+
+Basic Python environment
+
+``service.environment.development``
+-----------------------------------
+
+Development Python environment.
+
+``python.environment.django``
+-----------------------------
+
+Python Django environment.
+
+Sample pillars
+==============
+
+Simple Python environment
+
+.. code-block:: yaml
+
+ python:
+ environment:
+ enabled: true
+
+Development Python environment
+
+.. code-block:: yaml
+
+ python:
+ environment:
+ enabled: true
+ module:
+ development: true
+
+Python django environment
+
+.. code-block:: yaml
+
+ python:
+ environment:
+ enabled: true
+ module:
+ django: true
+
+Read more
+=========
+
+* https://www.python.org/
diff --git a/VERSION b/VERSION
new file mode 100644
index 0000000..3b04cfb
--- /dev/null
+++ b/VERSION
@@ -0,0 +1 @@
+0.2
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..273982b
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,11 @@
+salt-formula-python (0.2) trusty; urgency=medium
+
+ * First public release
+
+ -- Filip Pytloun <filip.pytloun@tcpcloud.eu> Tue, 06 Oct 2015 16:38:51 +0200
+
+salt-formula-python (0.1) trusty; urgency=medium
+
+ * Initial release
+
+ -- Ales Komarek <ales.komarek@tcpcloud.eu> Thu, 13 Aug 2015 23:23:41 +0200
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..ec63514
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+9
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..9e9cdfc
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,15 @@
+Source: salt-formula-python
+Maintainer: Ales Komarek <ales.komarek@tcpcloud.eu>
+Section: admin
+Priority: optional
+Build-Depends: debhelper (>= 9)
+Standards-Version: 3.9.6
+Homepage: http://www.tcpcloud.eu
+Vcs-Browser: https://github.com/tcpcloud/salt-formula-python
+Vcs-Git: https://github.com/tcpcloud/salt-formula-python.git
+
+Package: salt-formula-python
+Architecture: all
+Depends: ${misc:Depends}, salt-master, reclass
+Description: Python salt formula
+ Install Python application environment.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..c89cc76
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,15 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: salt-formula-python
+Upstream-Contact: Ales Komarek <ales.komarek@tcpcloud.eu>
+Source: https://github.com/tcpcloud/salt-formula-python
+
+Files: *
+Copyright: 2014-2015 tcp cloud a.s.
+License: Apache-2.0
+ Copyright (C) 2014-2015 tcp cloud a.s.
+ .
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ .
+ On a Debian system you can find a copy of this license in
+ /usr/share/common-licenses/Apache-2.0.
diff --git a/debian/docs b/debian/docs
new file mode 100644
index 0000000..d585829
--- /dev/null
+++ b/debian/docs
@@ -0,0 +1,3 @@
+README.rst
+CHANGELOG.rst
+VERSION
diff --git a/debian/install b/debian/install
new file mode 100644
index 0000000..dce5a0c
--- /dev/null
+++ b/debian/install
@@ -0,0 +1,2 @@
+python/* /usr/share/salt-formulas/env/python/
+metadata/service/* /usr/share/salt-formulas/reclass/service/python/
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..abde6ef
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,5 @@
+#!/usr/bin/make -f
+
+%:
+ dh $@
+
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..89ae9db
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (native)
diff --git a/metadata/service/environment/development.yml b/metadata/service/environment/development.yml
new file mode 100644
index 0000000..12d2fde
--- /dev/null
+++ b/metadata/service/environment/development.yml
@@ -0,0 +1,7 @@
+classes:
+- service.python.environment
+parameters:
+ python:
+ environment:
+ module:
+ development: True
diff --git a/metadata/service/environment/django.yml b/metadata/service/environment/django.yml
new file mode 100644
index 0000000..bdf646a
--- /dev/null
+++ b/metadata/service/environment/django.yml
@@ -0,0 +1,7 @@
+classes:
+- service.python.environment
+parameters:
+ python:
+ environment:
+ module:
+ django: True
diff --git a/metadata/service/environment/init.yml b/metadata/service/environment/init.yml
new file mode 100644
index 0000000..0f5140d
--- /dev/null
+++ b/metadata/service/environment/init.yml
@@ -0,0 +1,9 @@
+applications:
+- python
+parameters:
+ python:
+ environment:
+ enabled: true
+ module:
+ development: False
+ django: False
diff --git a/python/environment.sls b/python/environment.sls
new file mode 100644
index 0000000..34e0991
--- /dev/null
+++ b/python/environment.sls
@@ -0,0 +1,46 @@
+{%- from "python/map.jinja" import environment with context %}
+{%- from "linux/map.jinja" import network with context %}
+{%- if environment.enabled %}
+
+python_packages:
+ pkg.installed:
+ - names: {{ environment.pkgs.system }}
+
+{%- if environment.module.development %}
+
+python_development_packages:
+ pkg.installed:
+ - names: {{ environment.pkgs.development }}
+ - require:
+ - pkg: python_packages
+
+{%- if network.proxy.host == 'none' %}
+
+/root/pip/pip.conf:
+ file.absent
+
+{%- else %}
+
+/root/pip:
+ file.directory
+
+/root/pip/pip.conf:
+ file.managed:
+ - template: jinja
+ - source: salt://python/files/pip.conf
+
+{%- endif %}
+
+{%- endif %}
+
+{%- if environment.module.django %}
+
+python_django_packages:
+ pkg.installed:
+ - names: {{ environment.pkgs.django }}
+ - require:
+ - pkg: python_packages
+
+{%- endif %}
+
+{%- endif %}
\ No newline at end of file
diff --git a/python/files/pip.conf b/python/files/pip.conf
new file mode 100644
index 0000000..3c42cf7
--- /dev/null
+++ b/python/files/pip.conf
@@ -0,0 +1,4 @@
+{%- from "linux/map.jinja" import network with context %}
+
+[global]
+proxy = {{ network.proxy.host }}:{{ network.proxy.port }}
diff --git a/python/init.sls b/python/init.sls
new file mode 100644
index 0000000..a1f1d24
--- /dev/null
+++ b/python/init.sls
@@ -0,0 +1,5 @@
+
+{% if pillar.python.environment is defined %}
+include:
+- python.environment
+{% endif %}
diff --git a/python/map.jinja b/python/map.jinja
new file mode 100644
index 0000000..3dc7fac
--- /dev/null
+++ b/python/map.jinja
@@ -0,0 +1,66 @@
+{%- load_yaml as base_defaults %}
+Arch:
+ pkgs:
+ system:
+ - python
+ development:
+ - python-pip
+ - python-virtualenv
+ - python-setuptools
+ django:
+ - gettext
+ - python-imaging
+ - python-docutils
+ - python-simplejson
+ - python-tz
+ - python-memcache
+ - libssl-dev
+ - libffi-dev
+Debian:
+ pkgs:
+ system:
+ - python
+ development:
+ - python-pip
+ - python-virtualenv
+ - python-setuptools
+ - python-dev
+ - build-essential
+ django:
+ - gettext
+ - python-imaging
+ - python-docutils
+ - python-simplejson
+ - python-tz
+ - python-memcache
+ - libssl-dev
+ - libffi-dev
+RedHat:
+ pkgs:
+ system:
+ - python
+ development:
+ - python-pip
+ - python-virtualenv
+ - python-setuptools
+ - python-devel
+ django:
+ - gettext
+ - python-imaging
+ - python-docutils
+ - python-simplejson
+ - python-tz
+ - python-memcache
+ - libssl-dev
+ - libffi-dev
+{%- endload %}
+
+{%- set environment = salt['grains.filter_by'](base_defaults, merge=salt['pillar.get']('python:environment')) %}
+
+{# STARTLEAGACY: development setup #}
+
+{%- if environment.get('development', False) %}
+{% set _dummy = environment.module.update({'development':True}) %}
+{%- endif %}
+
+{# ENDLEAGACY #}