ol-openedx-git-auto-export 0.3__tar.gz → 0.3.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. {ol-openedx-git-auto-export-0.3/ol_openedx_git_auto_export.egg-info → ol-openedx-git-auto-export-0.3.2}/PKG-INFO +2 -6
  2. {ol-openedx-git-auto-export-0.3 → ol-openedx-git-auto-export-0.3.2}/backend_shim.py +10 -1
  3. {ol-openedx-git-auto-export-0.3 → ol-openedx-git-auto-export-0.3.2}/ol_openedx_git_auto_export/app.py +2 -2
  4. {ol-openedx-git-auto-export-0.3 → ol-openedx-git-auto-export-0.3.2}/ol_openedx_git_auto_export/settings/common.py +2 -2
  5. {ol-openedx-git-auto-export-0.3 → ol-openedx-git-auto-export-0.3.2}/ol_openedx_git_auto_export/settings/production.py +2 -2
  6. {ol-openedx-git-auto-export-0.3 → ol-openedx-git-auto-export-0.3.2}/ol_openedx_git_auto_export/signals.py +16 -7
  7. {ol-openedx-git-auto-export-0.3 → ol-openedx-git-auto-export-0.3.2}/ol_openedx_git_auto_export/tasks.py +7 -9
  8. {ol-openedx-git-auto-export-0.3 → ol-openedx-git-auto-export-0.3.2/ol_openedx_git_auto_export.egg-info}/PKG-INFO +2 -6
  9. {ol-openedx-git-auto-export-0.3 → ol-openedx-git-auto-export-0.3.2}/ol_openedx_git_auto_export.egg-info/entry_points.txt +0 -1
  10. ol-openedx-git-auto-export-0.3.2/ol_openedx_git_auto_export.egg-info/requires.txt +4 -0
  11. {ol-openedx-git-auto-export-0.3 → ol-openedx-git-auto-export-0.3.2}/setup.py +4 -3
  12. ol-openedx-git-auto-export-0.3/ol_openedx_git_auto_export.egg-info/requires.txt +0 -4
  13. {ol-openedx-git-auto-export-0.3 → ol-openedx-git-auto-export-0.3.2}/MANIFEST.in +0 -0
  14. {ol-openedx-git-auto-export-0.3 → ol-openedx-git-auto-export-0.3.2}/__init__.py +0 -0
  15. {ol-openedx-git-auto-export-0.3 → ol-openedx-git-auto-export-0.3.2}/ol_openedx_git_auto_export/__init__.py +0 -0
  16. {ol-openedx-git-auto-export-0.3 → ol-openedx-git-auto-export-0.3.2}/ol_openedx_git_auto_export/constants.py +0 -0
  17. {ol-openedx-git-auto-export-0.3 → ol-openedx-git-auto-export-0.3.2}/ol_openedx_git_auto_export/settings/__init__.py +0 -0
  18. {ol-openedx-git-auto-export-0.3 → ol-openedx-git-auto-export-0.3.2}/ol_openedx_git_auto_export.egg-info/SOURCES.txt +0 -0
  19. {ol-openedx-git-auto-export-0.3 → ol-openedx-git-auto-export-0.3.2}/ol_openedx_git_auto_export.egg-info/dependency_links.txt +0 -0
  20. {ol-openedx-git-auto-export-0.3 → ol-openedx-git-auto-export-0.3.2}/ol_openedx_git_auto_export.egg-info/namespace_packages.txt +0 -0
  21. {ol-openedx-git-auto-export-0.3 → ol-openedx-git-auto-export-0.3.2}/ol_openedx_git_auto_export.egg-info/top_level.txt +0 -0
  22. {ol-openedx-git-auto-export-0.3 → ol-openedx-git-auto-export-0.3.2}/setup.cfg +0 -0
@@ -1,10 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ol-openedx-git-auto-export
3
- Version: 0.3
3
+ Version: 0.3.2
4
4
  Summary: A plugin that auto saves the course OLX to git when an author publishes it
5
- Home-page: UNKNOWN
6
5
  License: BSD-3-Clause
7
- Platform: UNKNOWN
8
-
9
- UNKNOWN
10
-
6
+ Requires-Python: >=3.8
@@ -1,11 +1,13 @@
1
1
 
2
2
  # DO NOT EDIT THIS FILE -- AUTOGENERATED BY PANTS
3
3
 
4
+ import errno
5
+ import os
4
6
  import setuptools.build_meta
5
7
 
6
8
  backend = setuptools.build_meta.__legacy__
7
9
 
8
- dist_dir = "dist"
10
+ dist_dir = "dist/"
9
11
  build_wheel = True
10
12
  build_sdist = True
11
13
  wheel_config_settings = {
@@ -13,6 +15,13 @@ wheel_config_settings = {
13
15
  sdist_config_settings = {
14
16
  }
15
17
 
18
+ # Python 2.7 doesn't have the exist_ok arg on os.makedirs().
19
+ try:
20
+ os.makedirs(dist_dir)
21
+ except OSError as e:
22
+ if e.errno != errno.EEXIST:
23
+ raise
24
+
16
25
  wheel_path = backend.build_wheel(dist_dir, wheel_config_settings) if build_wheel else None
17
26
  sdist_path = backend.build_sdist(dist_dir, sdist_config_settings) if build_sdist else None
18
27
 
@@ -28,8 +28,8 @@ class GitAutoExportConfig(AppConfig):
28
28
  PluginSignals.RECEIVERS: [
29
29
  {
30
30
  PluginSignals.RECEIVER_FUNC_NAME: "listen_for_course_publish",
31
- PluginSignals.SIGNAL_PATH: "xmodule.modulestore.django.COURSE_PUBLISHED",
32
- PluginSignals.DISPATCH_UID: "ol_openedx_git_auto_export.signals.listen_for_course_publish",
31
+ PluginSignals.SIGNAL_PATH: "xmodule.modulestore.django.COURSE_PUBLISHED", # noqa: E501
32
+ PluginSignals.DISPATCH_UID: "ol_openedx_git_auto_export.signals.listen_for_course_publish", # noqa: E501
33
33
  }
34
34
  ],
35
35
  },
@@ -4,6 +4,6 @@ from ol_openedx_git_auto_export.constants import ENABLE_GIT_AUTO_EXPORT
4
4
 
5
5
 
6
6
  def plugin_settings(settings):
7
- """Settings for the git auto export plugin."""
8
- settings.GIT_REPO_EXPORT_DIR = "/edx/var/edxapp/export_course_repos"
7
+ """Settings for the git auto export plugin.""" # noqa: D401
8
+ settings.GIT_REPO_EXPORT_DIR = "/openedx/export_course_repos"
9
9
  settings.FEATURES[ENABLE_GIT_AUTO_EXPORT] = True
@@ -4,6 +4,6 @@ from ol_openedx_git_auto_export.constants import ENABLE_GIT_AUTO_EXPORT
4
4
 
5
5
 
6
6
  def plugin_settings(settings):
7
- """Settings for the git auto export plugin."""
8
- settings.GIT_REPO_EXPORT_DIR = "/edx/var/edxapp/export_course_repos"
7
+ """Settings for the git auto export plugin.""" # noqa: D401
8
+ settings.GIT_REPO_EXPORT_DIR = "/openedx/export_course_repos"
9
9
  settings.FEATURES[ENABLE_GIT_AUTO_EXPORT] = True
@@ -3,7 +3,7 @@ import os
3
3
 
4
4
  from django.conf import settings
5
5
  from django.dispatch import receiver
6
- from xmodule.modulestore.django import SignalHandler
6
+ from xmodule.modulestore.django import SignalHandler, modulestore
7
7
 
8
8
  from ol_openedx_git_auto_export.constants import ENABLE_GIT_AUTO_EXPORT
9
9
  from ol_openedx_git_auto_export.tasks import async_export_to_git
@@ -13,27 +13,36 @@ log = logging.getLogger(__name__)
13
13
 
14
14
  @receiver(SignalHandler.course_published)
15
15
  def listen_for_course_publish(
16
- sender, course_key, **kwargs
16
+ sender, # noqa: ARG001
17
+ course_key,
18
+ **kwargs, # noqa: ARG001
17
19
  ): # pylint: disable=unused-argument
18
20
  """
19
21
  Receives publishing signal and performs publishing related workflows
20
22
  """
21
23
  git_repo_export_dir = getattr(
22
- settings, "GIT_REPO_EXPORT_DIR", "/edx/var/edxapp/export_course_repos"
24
+ settings, "GIT_REPO_EXPORT_DIR", "/openedx/export_course_repos"
23
25
  )
24
- if not os.path.exists(git_repo_export_dir):
25
- # for development/docker/vagrant if GIT_REPO_EXPORT_DIR folder does not exist then create it
26
+ if not os.path.exists(git_repo_export_dir): # noqa: PTH110
27
+ # for development/docker/vagrant if GIT_REPO_EXPORT_DIR folder does not exist then create it # noqa: E501
26
28
  log.error(
27
29
  "GIT_REPO_EXPORT_DIR is not available in settings, please create it first"
28
30
  )
29
- os.makedirs(git_repo_export_dir, 0o755)
31
+ os.makedirs(git_repo_export_dir, 0o755) # noqa: PTH103
30
32
 
31
33
  if settings.FEATURES.get("ENABLE_EXPORT_GIT") and settings.FEATURES.get(
32
34
  ENABLE_GIT_AUTO_EXPORT
33
35
  ):
36
+ course_module = modulestore().get_course(course_key)
37
+ if not course_module.giturl:
38
+ log.info(
39
+ "Course %s does not have a GIT URL set in course advance settings, skipping export.", # noqa: E501
40
+ course_module.id,
41
+ )
42
+ return
34
43
  # If the Git auto-export is enabled, push the course changes to Git
35
44
  log.info(
36
- "Course published with auto-export enabled. Starting export... (course id: %s)",
45
+ "Course published with auto-export enabled. Starting export... (course id: %s)", # noqa: E501
37
46
  course_key,
38
47
  )
39
48
  async_export_to_git.delay(str(course_key))
@@ -11,7 +11,7 @@ LOGGER = get_task_logger(__name__)
11
11
  def async_export_to_git(course_key_string, user=None):
12
12
  """
13
13
  Exports a course to Git.
14
- """
14
+ """ # noqa: D401
15
15
  course_key = CourseKey.from_string(course_key_string)
16
16
  course_module = modulestore().get_course(course_key)
17
17
 
@@ -21,15 +21,13 @@ def async_export_to_git(course_key_string, user=None):
21
21
  course_module.id,
22
22
  )
23
23
  export_to_git(course_module.id, course_module.giturl, user=user)
24
- except GitExportError as ex:
25
- LOGGER.error(
26
- "Failed async course content export to git (course id: %s): %s",
24
+ except GitExportError:
25
+ LOGGER.exception(
26
+ "Failed async course content export to git (course id: %s)",
27
27
  course_module.id,
28
- ex,
29
28
  )
30
- except Exception as ex: # pylint: disable=broad-except
31
- LOGGER.error(
32
- "Unknown error occured during async course content export to git (course id: %s): %s",
29
+ except Exception:
30
+ LOGGER.exception(
31
+ "Unknown error occured during async course content export to git (course id: %s)", # noqa: E501
33
32
  course_module.id,
34
- ex,
35
33
  )
@@ -1,10 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ol-openedx-git-auto-export
3
- Version: 0.3
3
+ Version: 0.3.2
4
4
  Summary: A plugin that auto saves the course OLX to git when an author publishes it
5
- Home-page: UNKNOWN
6
5
  License: BSD-3-Clause
7
- Platform: UNKNOWN
8
-
9
- UNKNOWN
10
-
6
+ Requires-Python: >=3.8
@@ -1,3 +1,2 @@
1
1
  [cms.djangoapp]
2
2
  ol_openedx_git_auto_export = ol_openedx_git_auto_export.app:GitAutoExportConfig
3
-
@@ -0,0 +1,4 @@
1
+ Django>2.0
2
+ celery>=4.4.7
3
+ edx-django-utils>4.0.0
4
+ edx-opaque-keys<3.0.0,>=2.5.1
@@ -14,8 +14,8 @@ setup(**{
14
14
  'install_requires': (
15
15
  'Django>2.0',
16
16
  'celery>=4.4.7',
17
- 'edx-django-utils<5.0.0,>=4.0.0',
18
- 'edx-opaque-keys==2.3.0',
17
+ 'edx-django-utils>4.0.0',
18
+ 'edx-opaque-keys<3.0.0,>=2.5.1',
19
19
  ),
20
20
  'license': 'BSD-3-Clause',
21
21
  'name': 'ol-openedx-git-auto-export',
@@ -28,5 +28,6 @@ setup(**{
28
28
  'ol_openedx_git_auto_export',
29
29
  'ol_openedx_git_auto_export.settings',
30
30
  ),
31
- 'version': '0.3',
31
+ 'python_requires': '>=3.8',
32
+ 'version': '0.3.2',
32
33
  })
@@ -1,4 +0,0 @@
1
- Django>2.0
2
- celery>=4.4.7
3
- edx-django-utils<5.0.0,>=4.0.0
4
- edx-opaque-keys==2.3.0