Browse code

compile web assets into source distribution

Joseph Weston authored on 25/02/2018 16:08:32
Showing 3 changed files
... ...
@@ -1 +1,2 @@
1 1
 include LICENSE
2
+include-recursive nord/web/static/*
... ...
@@ -17,7 +17,7 @@
17 17
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 18
 
19 19
 import sys
20
-from setuptools import setup
20
+from setuptools import setup, find_packages
21 21
 
22 22
 
23 23
 if sys.version_info < (3, 6):
... ...
@@ -67,6 +67,16 @@ def get_version_and_cmdclass(package_name):
67 67
 version, cmdclass = get_version_and_cmdclass('nord')
68 68
 
69 69
 
70
+class sdist(cmdclass['sdist']):
71
+    def run(self):
72
+        import subprocess
73
+        subprocess.check_call(['yarn', 'install'])
74
+        subprocess.check_call(['yarn', 'build'])
75
+        super().run()
76
+
77
+
78
+cmdclass.update(dict(sdist=sdist))
79
+
70 80
 setup(
71 81
     name='nord',
72 82
     author='Joseph Weston',
... ...
@@ -77,7 +87,7 @@ setup(
77 87
     url='https://github.com/jbweston/nord',
78 88
     cmdclass=cmdclass,
79 89
     platforms=['GNU/Linux'],
80
-    packages=['nord'],
90
+    packages=find_packages('.'),
81 91
     long_description=long_description,
82 92
     install_requires=requirements,
83 93
     extras_require={
... ...
@@ -87,4 +97,6 @@ setup(
87 97
         [console_scripts]
88 98
         nord=nord.cli:main
89 99
     ''',
100
+    package_data={'nord.web': ['static/*']},
101
+    include_package_data=True,
90 102
 )
... ...
@@ -28,7 +28,7 @@ module.exports = {
28 28
             { test: /\.css$/,use: ['style-loader', 'css-loader'] },
29 29
             { test: /\.(png|jpg|gif)$/, loader: "file-loader" },
30 30
             { test: /\.(woff(2)?|ttf|eot|svg|otf)(\?v=\d+\.\d+\.\d+)?$/, loader: "file-loader" },
31
-            { test: /LICENSE/, loader: 'file-loader' },
31
+            { test: /LICENSE/, loader: 'file-loader', options: { name: '[name]'} },
32 32
             {
33 33
                 test: /\.geo\.json/,
34 34
                 loader: 'file-loader',