rename __main__.py to main.py so it can be imported

Signed-off-by: Mattia Rizzolo's avatarMattia Rizzolo <mattia@debian.org>
parent 515c4e85
......@@ -49,7 +49,7 @@ setuptools.setup(
entry_points = {
"console_scripts": [
"uitwww = uitwww.__main__:cli",
"uitwww = uitwww.main:cli",
],
},
......
......@@ -15,8 +15,10 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import sys
import click
import subprocess
import uitwww
from uitwww import utils
......@@ -80,3 +82,20 @@ def init(data):
print("Initializing data directory:", data)
data_path = os.path.expanduser(os.path.abspath(data))
uitwww.init_data_directory(data_path)
@cli.command("build_scss")
def build_scss():
"""Build the scss file"""
base_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')
scss_file = open('%s/assets/scss/www.scss' % base_dir, 'rb')
css_file = open('%s/uitwww/static/website.css' % base_dir, 'wb')
subprocess.run(
[sys.executable, '-mscss'],
stdin=scss_file,
stdout=css_file,
check=True,
)
css_file.flush()
scss_file.close()
css_file.close()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment